mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-21 05:15:07 +00:00
feat: update go boilerplate
This commit is contained in:
1 parent
181b48aff7
commit
f6fe61daac
7 files changed
+97
-88
No files matched your search
@@ -0,0 +1,58 @@
|
||||
package gildedrose
|
||||
|
||||
type Item struct {
|
||||
Name string
|
||||
SellIn, Quality int
|
||||
}
|
||||
|
||||
func UpdateQuality(items []*Item) {
|
||||
for i := 0; i < len(items); i++ {
|
||||
|
||||
if items[i].Name != "Aged Brie" && items[i].Name != "Backstage passes to a TAFKAL80ETC concert" {
|
||||
if items[i].Quality > 0 {
|
||||
if items[i].Name != "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 == "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 != "Sulfuras, Hand of Ragnaros" {
|
||||
items[i].SellIn = items[i].SellIn - 1
|
||||
}
|
||||
|
||||
if items[i].SellIn < 0 {
|
||||
if items[i].Name != "Aged Brie" {
|
||||
if items[i].Name != "Backstage passes to a TAFKAL80ETC concert" {
|
||||
if items[i].Quality > 0 {
|
||||
if items[i].Name != "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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user