Created
March 10, 2021 16:06
-
-
Save zivce/6de34658a97832bed8e299310218aa9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gildedrose; | |
class GildedRose { | |
Item[] items; | |
public GildedRose(Item[] items) { | |
this.items = items; | |
} | |
public void updateQuality() { | |
for (int i = 0; i < items.length; i++) { | |
if (!items[i].name.equals("Aged Brie") | |
&& !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) { | |
if (items[i].quality > 0) { | |
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { | |
items[i].quality = items[i].quality - 1; | |
} | |
} | |
} else { | |
if (items[i].quality < 50) { | |
items[i].quality = items[i].quality + 1; | |
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) { | |
if (items[i].sellIn < 11) { | |
if (items[i].quality < 50) { | |
items[i].quality = items[i].quality + 1; | |
} | |
} | |
if (items[i].sellIn < 6) { | |
if (items[i].quality < 50) { | |
items[i].quality = items[i].quality + 1; | |
} | |
} | |
} | |
} | |
} | |
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { | |
items[i].sellIn = items[i].sellIn - 1; | |
} | |
if (items[i].sellIn < 0) { | |
if (!items[i].name.equals("Aged Brie")) { | |
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) { | |
if (items[i].quality > 0) { | |
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { | |
items[i].quality = items[i].quality - 1; | |
} | |
} | |
} else { | |
items[i].quality = items[i].quality - items[i].quality; | |
} | |
} else { | |
if (items[i].quality < 50) { | |
items[i].quality = items[i].quality + 1; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment