From 468891990e0acf3bdad19e5488fdd01c88475362 Mon Sep 17 00:00:00 2001 From: Tim Rourke Date: Thu, 18 May 2023 11:41:15 -0500 Subject: [PATCH] Make english language version more inclusive --- Ada/ThirtyDays.txt | 558 +++++++++--------- Ada/gilded_rose.adb | 16 +- Ada/program.adb | 20 +- C/GildedRose.c | 26 +- C/GildedRoseTextTests.c | 26 +- C/GildedRoseUnitTests.cc | 14 +- COBOL/Gnu/GildedRose.cbl | 16 +- COBOL/mf/src/GildedRose.cbl | 16 +- Delphi/GildedRose.pas | 14 +- Delphi/TextTestFixture.dpr | 20 +- GildedRoseRequirements.txt | 32 +- GildedRoseRequirements_de.md | 10 +- GildedRoseRequirements_es.md | 6 +- GildedRoseRequirements_fr.md | 12 +- GildedRoseRequirements_jp.md | 12 +- GildedRoseRequirements_kr.md | 12 +- GildedRoseRequirements_pl.md | 8 +- GildedRoseRequirements_pt-BR.md | 8 +- GildedRoseRequirements_ru.txt | 10 +- GildedRoseRequirements_th.md | 10 +- GildedRoseRequirements_zh.txt | 10 +- .../groovy/com/gildedrose/GildedRose.groovy | 16 +- .../com/gildedrose/TexttestFixture.groovy | 20 +- .../main/java/com/gildedrose/GildedRose.java | 18 +- .../src/main/java/com/gildedrose/Program.java | 22 +- .../main/java/com/gildedrose/GildedRose.java | 16 +- .../java/com/gildedrose/TexttestFixture.java | 20 +- .../main/java/com/gildedrose/GildedRose.java | 16 +- .../java/com/gildedrose/TexttestFixture.java | 20 +- .../main/java/com/gildedrose/GildedRose.java | 18 +- .../java/com/gildedrose/TexttestFixture.java | 20 +- .../main/kotlin/com/gildedrose/GildedRose.kt | 14 +- .../kotlin/com/gildedrose/TexttestFixture.kt | 20 +- R/gilded_rose.R | 28 +- R/texttest_fixture.R | 22 +- Smalltalk/GildedRose.st | 46 +- TypeScript/app/gilded-rose.ts | 14 +- TypeScript/test/golden-master-text-test.ts | 20 +- abap/YY_PAO_GILDED_ROSE.abap | 46 +- c99/GildedRose.c | 20 +- c99/GildedRoseTextTests.c | 26 +- clojure/src/gilded/core.clj | 16 +- clojure/src/gilded/main.clj | 18 +- commonlisp/gilded-rose-functional.lisp | 48 +- commonlisp/gilded-rose.lisp | 48 +- cpp-catch2/src/GildedRose.cc | 18 +- cpp/src/GildedRose.cc | 18 +- cpp/test/cpp_texttest/GildedRoseTextTests.cc | 20 +- csharp/GildedRose.cs | 14 +- csharp/Program.cs | 22 +- .../GildedRose/GildedRose.cs | 14 +- csharpcore-Verify.xunit/GildedRose/Program.cs | 20 +- csharpcore/GildedRose/GildedRose.cs | 14 +- csharpcore/GildedRoseTests/TexttestFixture.cs | 20 +- d/src/GildedRose.d | 16 +- d/src/GildedRoseTextTests.d | 20 +- d/test/GildedRoseUnitTests.d | 12 +- dart/bin/main.dart | 20 +- dart/lib/gilded_rose.dart | 16 +- elixir/lib/gilded_rose.ex | 18 +- elm/src/GildedRose.elm | 6 +- erlang/src/gilded_rose.erl | 14 +- erlang/src/main.erl | 18 +- fortran/src/GildedRose.f90 | 46 +- fortran/test/GildedRose_text_test.f90 | 22 +- ...eTest.ApprovalTest.ThirtyDays.received.txt | 558 +++++++++--------- fsharp-core/GildedRose/Program.fs | 50 +- fsharp/GildedRose/GildedRose.fs | 52 +- go/gildedrose/gildedrose.go | 14 +- go/texttest_fixture.go | 18 +- haskell/src/GildedRose.hs | 16 +- haskell/src/Main.hs | 20 +- jq/gilded-rose.jq | 14 +- jq/texttest_fixture.jq | 18 +- js-jasmine/spec/texttest_fixture.js | 20 +- js-jasmine/src/gilded_rose.js | 14 +- js-jest/src/gilded_rose.js | 14 +- js-jest/test/texttest_fixture.js | 20 +- js-mocha/src/gilded_rose.js | 14 +- js-mocha/test/texttest_fixture.js | 20 +- julia/gilded_rose.jl | 32 +- lfe/src/gilded-rose.lfe | 48 +- pascal/ROSE.PAS | 16 +- pascal/TEXTTEST.PAS | 20 +- perl/GildedRose.pm | 16 +- perl/texttest_fixture.pl | 20 +- perl6/lib/GildedRose.pm6 | 14 +- perl6/texttest_fixture.p6 | 20 +- php/fixtures/texttest_fixture.php | 20 +- php/src/GildedRose.php | 14 +- .../ApprovalTest.testTestFixture.approved.txt | 558 +++++++++--------- plantuml/gilded-rose.puml | 14 +- plantuml/history/04_aged-brie.puml | 4 +- plantuml/history/05_quality-max-50.puml | 4 +- plantuml/history/06_sulfuras.puml | 10 +- plantuml/history/07_backstage-passes.puml | 14 +- plpgsql/README.md | 2 +- plpgsql/pgunit/run_tests.sql | 60 +- plpgsql/src/update_quality.sql | 14 +- plsql/texttest.pkb | 56 +- plsql/update_quality.sql | 14 +- python/gilded_rose.py | 14 +- python/texttest_fixture.py | 18 +- ruby/gilded_rose.rb | 14 +- ruby/texttest_fixture.rb | 20 +- rust/src/gildedrose.rs | 14 +- rust/src/main.rs | 20 +- .../scala/com/gildedrose/GildedRose.scala | 18 +- .../com/gildedrose/TexttestFixture.scala | 20 +- scheme/gilded-rose.scm | 16 +- scheme/texttest-fixture.scm | 20 +- sql/code/update_quality.sql | 30 +- sql/test/data/load.sql | 20 +- swift/Sources/GildedRose/GildedRose.swift | 14 +- swift/Sources/GildedRoseApp/main.swift | 20 +- texttests/ThirtyDays/stdout.gr | 558 +++++++++--------- vbnet/GildedRoseKata/GildedRose.vb | 16 +- vbnet/GildedRoseKata/Program.vb | 18 +- xslt/texttest_fixture.xml | 20 +- xslt/update_quality.xsl | 14 +- 120 files changed, 2256 insertions(+), 2256 deletions(-) diff --git a/Ada/ThirtyDays.txt b/Ada/ThirtyDays.txt index a04e48ac..75ba4b52 100644 --- a/Ada/ThirtyDays.txt +++ b/Ada/ThirtyDays.txt @@ -1,373 +1,373 @@ OMGHAI! -------- day 0 -------- name, sellIn, quality -+5 Dexterity Vest, 10, 20 -Aged Brie, 2, 0 -Elixir of the Mongoose, 5, 7 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 15, 20 -Backstage passes to a TAFKAL80ETC concert, 10, 49 -Backstage passes to a TAFKAL80ETC concert, 5, 49 -Conjured Mana Cake, 3, 6 +Sports Memorabilia, 10, 20 +Aged Cheese, 2, 0 +Coffee Table Book, 5, 7 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 15, 20 +Backstage passes to a concert, 10, 49 +Backstage passes to a concert, 5, 49 +Baked Chocolate Cake, 3, 6 -------- day 1 -------- name, sellIn, quality -+5 Dexterity Vest, 9, 19 -Aged Brie, 1, 1 -Elixir of the Mongoose, 4, 6 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 14, 21 -Backstage passes to a TAFKAL80ETC concert, 9, 50 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Conjured Mana Cake, 2, 5 +Sports Memorabilia, 9, 19 +Aged Cheese, 1, 1 +Coffee Table Book, 4, 6 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 14, 21 +Backstage passes to a concert, 9, 50 +Backstage passes to a concert, 4, 50 +Baked Chocolate Cake, 2, 5 -------- day 2 -------- name, sellIn, quality -+5 Dexterity Vest, 8, 18 -Aged Brie, 0, 2 -Elixir of the Mongoose, 3, 5 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 13, 22 -Backstage passes to a TAFKAL80ETC concert, 8, 50 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Conjured Mana Cake, 1, 4 +Sports Memorabilia, 8, 18 +Aged Cheese, 0, 2 +Coffee Table Book, 3, 5 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 13, 22 +Backstage passes to a concert, 8, 50 +Backstage passes to a concert, 3, 50 +Baked Chocolate Cake, 1, 4 -------- day 3 -------- name, sellIn, quality -+5 Dexterity Vest, 7, 17 -Aged Brie, -1, 4 -Elixir of the Mongoose, 2, 4 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 12, 23 -Backstage passes to a TAFKAL80ETC concert, 7, 50 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Conjured Mana Cake, 0, 3 +Sports Memorabilia, 7, 17 +Aged Cheese, -1, 4 +Coffee Table Book, 2, 4 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 12, 23 +Backstage passes to a concert, 7, 50 +Backstage passes to a concert, 2, 50 +Baked Chocolate Cake, 0, 3 -------- day 4 -------- name, sellIn, quality -+5 Dexterity Vest, 6, 16 -Aged Brie, -2, 6 -Elixir of the Mongoose, 1, 3 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 11, 24 -Backstage passes to a TAFKAL80ETC concert, 6, 50 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Conjured Mana Cake, -1, 1 +Sports Memorabilia, 6, 16 +Aged Cheese, -2, 6 +Coffee Table Book, 1, 3 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 11, 24 +Backstage passes to a concert, 6, 50 +Backstage passes to a concert, 1, 50 +Baked Chocolate Cake, -1, 1 -------- day 5 -------- name, sellIn, quality -+5 Dexterity Vest, 5, 15 -Aged Brie, -3, 8 -Elixir of the Mongoose, 0, 2 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 10, 25 -Backstage passes to a TAFKAL80ETC concert, 5, 50 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Conjured Mana Cake, -2, 0 +Sports Memorabilia, 5, 15 +Aged Cheese, -3, 8 +Coffee Table Book, 0, 2 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 10, 25 +Backstage passes to a concert, 5, 50 +Backstage passes to a concert, 0, 50 +Baked Chocolate Cake, -2, 0 -------- day 6 -------- name, sellIn, quality -+5 Dexterity Vest, 4, 14 -Aged Brie, -4, 10 -Elixir of the Mongoose, -1, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 9, 27 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Conjured Mana Cake, -3, 0 +Sports Memorabilia, 4, 14 +Aged Cheese, -4, 10 +Coffee Table Book, -1, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 9, 27 +Backstage passes to a concert, 4, 50 +Backstage passes to a concert, -1, 0 +Baked Chocolate Cake, -3, 0 -------- day 7 -------- name, sellIn, quality -+5 Dexterity Vest, 3, 13 -Aged Brie, -5, 12 -Elixir of the Mongoose, -2, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 8, 29 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Conjured Mana Cake, -4, 0 +Sports Memorabilia, 3, 13 +Aged Cheese, -5, 12 +Coffee Table Book, -2, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 8, 29 +Backstage passes to a concert, 3, 50 +Backstage passes to a concert, -2, 0 +Baked Chocolate Cake, -4, 0 -------- day 8 -------- name, sellIn, quality -+5 Dexterity Vest, 2, 12 -Aged Brie, -6, 14 -Elixir of the Mongoose, -3, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 7, 31 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Conjured Mana Cake, -5, 0 +Sports Memorabilia, 2, 12 +Aged Cheese, -6, 14 +Coffee Table Book, -3, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 7, 31 +Backstage passes to a concert, 2, 50 +Backstage passes to a concert, -3, 0 +Baked Chocolate Cake, -5, 0 -------- day 9 -------- name, sellIn, quality -+5 Dexterity Vest, 1, 11 -Aged Brie, -7, 16 -Elixir of the Mongoose, -4, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 6, 33 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Conjured Mana Cake, -6, 0 +Sports Memorabilia, 1, 11 +Aged Cheese, -7, 16 +Coffee Table Book, -4, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 6, 33 +Backstage passes to a concert, 1, 50 +Backstage passes to a concert, -4, 0 +Baked Chocolate Cake, -6, 0 -------- day 10 -------- name, sellIn, quality -+5 Dexterity Vest, 0, 10 -Aged Brie, -8, 18 -Elixir of the Mongoose, -5, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 5, 35 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Conjured Mana Cake, -7, 0 +Sports Memorabilia, 0, 10 +Aged Cheese, -8, 18 +Coffee Table Book, -5, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 5, 35 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Baked Chocolate Cake, -7, 0 -------- day 11 -------- name, sellIn, quality -+5 Dexterity Vest, -1, 8 -Aged Brie, -9, 20 -Elixir of the Mongoose, -6, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 4, 38 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Conjured Mana Cake, -8, 0 +Sports Memorabilia, -1, 8 +Aged Cheese, -9, 20 +Coffee Table Book, -6, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 4, 38 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Baked Chocolate Cake, -8, 0 -------- day 12 -------- name, sellIn, quality -+5 Dexterity Vest, -2, 6 -Aged Brie, -10, 22 -Elixir of the Mongoose, -7, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 3, 41 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Conjured Mana Cake, -9, 0 +Sports Memorabilia, -2, 6 +Aged Cheese, -10, 22 +Coffee Table Book, -7, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 3, 41 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Baked Chocolate Cake, -9, 0 -------- day 13 -------- name, sellIn, quality -+5 Dexterity Vest, -3, 4 -Aged Brie, -11, 24 -Elixir of the Mongoose, -8, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 2, 44 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Conjured Mana Cake, -10, 0 +Sports Memorabilia, -3, 4 +Aged Cheese, -11, 24 +Coffee Table Book, -8, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 2, 44 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Baked Chocolate Cake, -10, 0 -------- day 14 -------- name, sellIn, quality -+5 Dexterity Vest, -4, 2 -Aged Brie, -12, 26 -Elixir of the Mongoose, -9, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 1, 47 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Conjured Mana Cake, -11, 0 +Sports Memorabilia, -4, 2 +Aged Cheese, -12, 26 +Coffee Table Book, -9, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 1, 47 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Baked Chocolate Cake, -11, 0 -------- day 15 -------- name, sellIn, quality -+5 Dexterity Vest, -5, 0 -Aged Brie, -13, 28 -Elixir of the Mongoose, -10, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Conjured Mana Cake, -12, 0 +Sports Memorabilia, -5, 0 +Aged Cheese, -13, 28 +Coffee Table Book, -10, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Baked Chocolate Cake, -12, 0 -------- day 16 -------- name, sellIn, quality -+5 Dexterity Vest, -6, 0 -Aged Brie, -14, 30 -Elixir of the Mongoose, -11, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Conjured Mana Cake, -13, 0 +Sports Memorabilia, -6, 0 +Aged Cheese, -14, 30 +Coffee Table Book, -11, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Baked Chocolate Cake, -13, 0 -------- day 17 -------- name, sellIn, quality -+5 Dexterity Vest, -7, 0 -Aged Brie, -15, 32 -Elixir of the Mongoose, -12, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Conjured Mana Cake, -14, 0 +Sports Memorabilia, -7, 0 +Aged Cheese, -15, 32 +Coffee Table Book, -12, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Baked Chocolate Cake, -14, 0 -------- day 18 -------- name, sellIn, quality -+5 Dexterity Vest, -8, 0 -Aged Brie, -16, 34 -Elixir of the Mongoose, -13, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Conjured Mana Cake, -15, 0 +Sports Memorabilia, -8, 0 +Aged Cheese, -16, 34 +Coffee Table Book, -13, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Baked Chocolate Cake, -15, 0 -------- day 19 -------- name, sellIn, quality -+5 Dexterity Vest, -9, 0 -Aged Brie, -17, 36 -Elixir of the Mongoose, -14, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Conjured Mana Cake, -16, 0 +Sports Memorabilia, -9, 0 +Aged Cheese, -17, 36 +Coffee Table Book, -14, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Baked Chocolate Cake, -16, 0 -------- day 20 -------- name, sellIn, quality -+5 Dexterity Vest, -10, 0 -Aged Brie, -18, 38 -Elixir of the Mongoose, -15, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Conjured Mana Cake, -17, 0 +Sports Memorabilia, -10, 0 +Aged Cheese, -18, 38 +Coffee Table Book, -15, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Baked Chocolate Cake, -17, 0 -------- day 21 -------- name, sellIn, quality -+5 Dexterity Vest, -11, 0 -Aged Brie, -19, 40 -Elixir of the Mongoose, -16, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Conjured Mana Cake, -18, 0 +Sports Memorabilia, -11, 0 +Aged Cheese, -19, 40 +Coffee Table Book, -16, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Baked Chocolate Cake, -18, 0 -------- day 22 -------- name, sellIn, quality -+5 Dexterity Vest, -12, 0 -Aged Brie, -20, 42 -Elixir of the Mongoose, -17, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Conjured Mana Cake, -19, 0 +Sports Memorabilia, -12, 0 +Aged Cheese, -20, 42 +Coffee Table Book, -17, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Baked Chocolate Cake, -19, 0 -------- day 23 -------- name, sellIn, quality -+5 Dexterity Vest, -13, 0 -Aged Brie, -21, 44 -Elixir of the Mongoose, -18, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Conjured Mana Cake, -20, 0 +Sports Memorabilia, -13, 0 +Aged Cheese, -21, 44 +Coffee Table Book, -18, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Baked Chocolate Cake, -20, 0 -------- day 24 -------- name, sellIn, quality -+5 Dexterity Vest, -14, 0 -Aged Brie, -22, 46 -Elixir of the Mongoose, -19, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Conjured Mana Cake, -21, 0 +Sports Memorabilia, -14, 0 +Aged Cheese, -22, 46 +Coffee Table Book, -19, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Baked Chocolate Cake, -21, 0 -------- day 25 -------- name, sellIn, quality -+5 Dexterity Vest, -15, 0 -Aged Brie, -23, 48 -Elixir of the Mongoose, -20, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Conjured Mana Cake, -22, 0 +Sports Memorabilia, -15, 0 +Aged Cheese, -23, 48 +Coffee Table Book, -20, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Baked Chocolate Cake, -22, 0 -------- day 26 -------- name, sellIn, quality -+5 Dexterity Vest, -16, 0 -Aged Brie, -24, 50 -Elixir of the Mongoose, -21, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Backstage passes to a TAFKAL80ETC concert, -21, 0 -Conjured Mana Cake, -23, 0 +Sports Memorabilia, -16, 0 +Aged Cheese, -24, 50 +Coffee Table Book, -21, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Backstage passes to a concert, -21, 0 +Baked Chocolate Cake, -23, 0 -------- day 27 -------- name, sellIn, quality -+5 Dexterity Vest, -17, 0 -Aged Brie, -25, 50 -Elixir of the Mongoose, -22, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Backstage passes to a TAFKAL80ETC concert, -22, 0 -Conjured Mana Cake, -24, 0 +Sports Memorabilia, -17, 0 +Aged Cheese, -25, 50 +Coffee Table Book, -22, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Backstage passes to a concert, -22, 0 +Baked Chocolate Cake, -24, 0 -------- day 28 -------- name, sellIn, quality -+5 Dexterity Vest, -18, 0 -Aged Brie, -26, 50 -Elixir of the Mongoose, -23, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Backstage passes to a TAFKAL80ETC concert, -23, 0 -Conjured Mana Cake, -25, 0 +Sports Memorabilia, -18, 0 +Aged Cheese, -26, 50 +Coffee Table Book, -23, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Backstage passes to a concert, -23, 0 +Baked Chocolate Cake, -25, 0 -------- day 29 -------- name, sellIn, quality -+5 Dexterity Vest, -19, 0 -Aged Brie, -27, 50 -Elixir of the Mongoose, -24, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Backstage passes to a TAFKAL80ETC concert, -24, 0 -Conjured Mana Cake, -26, 0 +Sports Memorabilia, -19, 0 +Aged Cheese, -27, 50 +Coffee Table Book, -24, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Backstage passes to a concert, -24, 0 +Baked Chocolate Cake, -26, 0 -------- day 30 -------- name, sellIn, quality -+5 Dexterity Vest, -20, 0 -Aged Brie, -28, 50 -Elixir of the Mongoose, -25, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Backstage passes to a TAFKAL80ETC concert, -25, 0 -Conjured Mana Cake, -27, 0 +Sports Memorabilia, -20, 0 +Aged Cheese, -28, 50 +Coffee Table Book, -25, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Backstage passes to a concert, -25, 0 +Baked Chocolate Cake, -27, 0 diff --git a/Ada/gilded_rose.adb b/Ada/gilded_rose.adb index fdcc5aa3..4a674c4b 100644 --- a/Ada/gilded_rose.adb +++ b/Ada/gilded_rose.adb @@ -6,10 +6,10 @@ package body Gilded_Rose is Cursor : Item_Vecs.Cursor := Item_Vecs.First(Self.Items); begin while Item_Vecs.Has_Element(Cursor) loop - if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Brie") - and Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then + if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Cheese") + and Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a concert") then if Self.Items(Cursor).Quality > 0 then - if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then + if Self.Items(Cursor).Name /= To_Unbounded_String("Fine Italian Silk") then Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - 1; end if; end if; @@ -17,7 +17,7 @@ package body Gilded_Rose is if Self.Items(Cursor).Quality < 50 then Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1; - if Self.Items(Cursor).Name = To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then + if Self.Items(Cursor).Name = To_Unbounded_String("Backstage passes to a concert") then if Self.Items(Cursor).Sell_In < 11 then if Self.Items(Cursor).Quality < 50 then Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1; @@ -33,15 +33,15 @@ package body Gilded_Rose is end if; end if; - if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then + if Self.Items(Cursor).Name /= To_Unbounded_String("Fine Italian Silk") then Self.Items(Cursor).Sell_In := Self.Items(Cursor).Sell_In - 1; end if; if Self.Items(Cursor).Sell_In < 0 then - if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Brie") then - if Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then + if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Cheese") then + if Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a concert") then if Self.Items(Cursor).Quality > 0 then - if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then + if Self.Items(Cursor).Name /= To_Unbounded_String("Fine Italian Silk") then Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - 1; end if; end if; diff --git a/Ada/program.adb b/Ada/program.adb index 336f952a..d6159f2b 100644 --- a/Ada/program.adb +++ b/Ada/program.adb @@ -14,40 +14,40 @@ procedure Program is Things : Item_Vecs.Vector; begin Things.Append(New_Item => - (Name => To_Unbounded_String("+5 Dexterity Vest"), + (Name => To_Unbounded_String("Sports Memorabilia"), Sell_In => 10, Quality => 20)); Things.Append(New_Item => - (Name => To_Unbounded_String("Aged Brie"), + (Name => To_Unbounded_String("Aged Cheese"), Sell_In => 2, Quality => 0)); Things.Append(New_Item => - (Name => To_Unbounded_String("Elixir of the Mongoose"), + (Name => To_Unbounded_String("Coffee Table Book"), Sell_In => 5, Quality => 7)); Things.Append(New_Item => - (Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"), + (Name => To_Unbounded_String("Fine Italian Silk"), Sell_In => 0, Quality => 80)); Things.Append(New_Item => - (Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"), + (Name => To_Unbounded_String("Fine Italian Silk"), Sell_In => -1, Quality => 80)); Things.Append(New_Item => - (Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"), + (Name => To_Unbounded_String("Backstage passes to a concert"), Sell_In => 15, Quality => 20)); Things.Append(New_Item => - (Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"), + (Name => To_Unbounded_String("Backstage passes to a concert"), Sell_In => 10, Quality => 49)); Things.Append(New_Item => - (Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"), + (Name => To_Unbounded_String("Backstage passes to a concert"), Sell_In => 5, Quality => 49)); - -- this conjured item does not work properly yet + -- this Baked item does not work properly yet Things.Append(New_Item => - (Name => To_Unbounded_String("Conjured Mana Cake"), + (Name => To_Unbounded_String("Baked Chocolate Cake"), Sell_In => 3, Quality => 6)); diff --git a/C/GildedRose.c b/C/GildedRose.c index 5c86edc3..5535c008 100644 --- a/C/GildedRose.c +++ b/C/GildedRose.c @@ -8,28 +8,28 @@ init_item(Item* item, const char *name, int sellIn, int quality) item->sellIn = sellIn; item->quality = quality; item->name = strdup(name); - + return item; } -extern char* -print_item(char* buffer, Item* item) +extern char* +print_item(char* buffer, Item* item) { sprintf(buffer, "%s, %d, %d", item->name, item->sellIn, item->quality); } -void -update_quality(Item items[], int size) +void +update_quality(Item items[], int size) { int i; - + for (i = 0; i < size; i++) { - if (strcmp(items[i].name, "Aged Brie") && strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert")) + if (strcmp(items[i].name, "Aged Cheese") && strcmp(items[i].name, "Backstage passes to a concert")) { if (items[i].quality > 0) { - if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros")) + if (strcmp(items[i].name, "Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } @@ -41,7 +41,7 @@ update_quality(Item items[], int size) { items[i].quality = items[i].quality + 1; - if (!strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert")) + if (!strcmp(items[i].name, "Backstage passes to a concert")) { if (items[i].sellIn < 11) { @@ -62,20 +62,20 @@ update_quality(Item items[], int size) } } - if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros")) + if (strcmp(items[i].name, "Fine Italian Silk")) { items[i].sellIn = items[i].sellIn - 1; } if (items[i].sellIn < 0) { - if (strcmp(items[i].name, "Aged Brie")) + if (strcmp(items[i].name, "Aged Cheese")) { - if (strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert")) + if (strcmp(items[i].name, "Backstage passes to a concert")) { if (items[i].quality > 0) { - if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros")) + if (strcmp(items[i].name, "Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } diff --git a/C/GildedRoseTextTests.c b/C/GildedRoseTextTests.c index d200ca0c..e99ac81c 100644 --- a/C/GildedRoseTextTests.c +++ b/C/GildedRoseTextTests.c @@ -13,18 +13,18 @@ int main() int last = 0; int day; int index; - - init_item(items + last++, "+5 Dexterity Vest", 10, 20); - init_item(items + last++, "Aged Brie", 2, 0); - init_item(items + last++, "Elixir of the Mongoose", 5, 7); - init_item(items + last++, "Sulfuras, Hand of Ragnaros", 0, 80); - init_item(items + last++, "Sulfuras, Hand of Ragnaros", -1, 80); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 15, 20); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 10, 49); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 5, 49); - // this Conjured item doesn't yet work properly - init_item(items + last++, "Conjured Mana Cake", 3, 6); - + + init_item(items + last++, "Sports Memorabilia", 10, 20); + init_item(items + last++, "Aged Cheese", 2, 0); + init_item(items + last++, "Coffee Table Book", 5, 7); + init_item(items + last++, "Fine Italian Silk", 0, 80); + init_item(items + last++, "Fine Italian Silk", -1, 80); + init_item(items + last++, "Backstage passes to a concert", 15, 20); + init_item(items + last++, "Backstage passes to a concert", 10, 49); + init_item(items + last++, "Backstage passes to a concert", 5, 49); + // this Baked item doesn't yet work properly + init_item(items + last++, "Baked Chocolate Cake", 3, 6); + puts("OMGHAI!"); for (day = 0; day <= 30; day++) @@ -34,7 +34,7 @@ int main() for(index = 0; index < last; index++) { print_item(items + index); } - + printf("\n"); update_quality(items, last); diff --git a/C/GildedRoseUnitTests.cc b/C/GildedRoseUnitTests.cc index ff7dec86..db72f673 100644 --- a/C/GildedRoseUnitTests.cc +++ b/C/GildedRoseUnitTests.cc @@ -26,13 +26,13 @@ void example() { Item items[6]; int last = 0; - - init_item(items + last++, "+5 Dexterity Vest", 10, 20); - init_item(items + last++, "Aged Brie", 2, 0); - init_item(items + last++, "Elixir of the Mongoose", 5, 7); - init_item(items + last++, "Sulfuras, Hand of Ragnaros", 0, 80); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 15, 20); - init_item(items + last++, "Conjured Mana Cake", 3, 6); + + init_item(items + last++, "Sports Memorabilia", 10, 20); + init_item(items + last++, "Aged Cheese", 2, 0); + init_item(items + last++, "Coffee Table Book", 5, 7); + init_item(items + last++, "Fine Italian Silk", 0, 80); + init_item(items + last++, "Backstage passes to a concert", 15, 20); + init_item(items + last++, "Baked Chocolate Cake", 3, 6); update_quality(items, last); } diff --git a/COBOL/Gnu/GildedRose.cbl b/COBOL/Gnu/GildedRose.cbl index 5a234473..562094f7 100644 --- a/COBOL/Gnu/GildedRose.cbl +++ b/COBOL/Gnu/GildedRose.cbl @@ -24,16 +24,16 @@ procedure division. start-lable. read in-items end go to end-lable. move in-item to item. - if name not equal "Aged Brie" and name not equal "Backstage passes to a TAFKAL80ETC concert" + if name not equal "Aged Cheese" and name not equal "Backstage passes to a concert" if quality > 0 - if name not equal to "Sulfuras, Hand of Ragnaros" + if name not equal to "Fine Italian Silk" compute quality = quality - 1 - end-if + end-if end-if else if quality < 50 compute quality = quality + 1 - if name equals "Backstage passes to a TAFKAL80ETC concert" + if name equals "Backstage passes to a concert" if sell-in < 11 if quality < 50 compute quality = quality + 1 @@ -47,14 +47,14 @@ start-lable. end-if end-if end-if - if name not equal "Sulfuras, Hand of Ragnaros" + if name not equal "Fine Italian Silk" compute sell-in = sell-in - 1 end-if if sell-in < 0 - if name is not equal to "Aged Brie" - if name is not equal to "Backstage passes to a TAFKAL80ETC concert" + if name is not equal to "Aged Cheese" + if name is not equal to "Backstage passes to a concert" if quality > 0 - if name is equal to "Sulfuras, Hand of Ragnaros" + if name is equal to "Fine Italian Silk" compute quality = quality - 1 end-if end-if diff --git a/COBOL/mf/src/GildedRose.cbl b/COBOL/mf/src/GildedRose.cbl index 28ff10a2..3524eccc 100644 --- a/COBOL/mf/src/GildedRose.cbl +++ b/COBOL/mf/src/GildedRose.cbl @@ -20,16 +20,16 @@ procedure division. start-lable. read in-items end go to end-lable. move in-item to item. - if name not equal "Aged Brie" and name not equal "Backstage passes to a TAFKAL80ETC concert" + if name not equal "Aged Cheese" and name not equal "Backstage passes to a concert" if quality greater then 0 - if name not equal to "Sulfuras, Hand of Ragnaros" + if name not equal to "Fine Italian Silk" compute quality = quality - 1 - end-if + end-if end-if else if quality is less then 50 compute quality = quality + 1 - if name equals "Backstage passes to a TAFKAL80ETC concert" + if name equals "Backstage passes to a concert" if sell-in less then 11 if quality less then 50 compute quality = quality + 1 @@ -43,14 +43,14 @@ start-lable. end-if end-if end-if - if name not equal "Sulfuras, Hand of Ragnaros" + if name not equal "Fine Italian Silk" compute sell-in = sell-in - 1 end-if if sell-in is less then 0 - if name is not equal to "Aged Brie" - if name is not equal to "Backstage passes to a TAFKAL80ETC concert" + if name is not equal to "Aged Cheese" + if name is not equal to "Backstage passes to a concert" if quality is greater then 0 - if name is equal to "Sulfuras, Hand of Ragnaros" + if name is equal to "Fine Italian Silk" compute quality = quality - 1 end-if end-if diff --git a/Delphi/GildedRose.pas b/Delphi/GildedRose.pas index dacd209f..d4a1a961 100644 --- a/Delphi/GildedRose.pas +++ b/Delphi/GildedRose.pas @@ -32,11 +32,11 @@ var begin for I := 0 to Items.Count - 1 do begin - if (Items[I].Name <> 'Aged Brie') and (Items[I].Name <> 'Backstage passes to a TAFKAL80ETC concert') then + if (Items[I].Name <> 'Aged Cheese') and (Items[I].Name <> 'Backstage passes to a concert') then begin if Items[I].Quality > 0 then begin - if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then + if Items[I].Name <> 'Fine Italian Silk' then begin Items[I].Quality := Items[I].Quality - 1; end; @@ -47,7 +47,7 @@ begin if Items[I].Quality < 50 then begin Items[I].Quality := Items[I].Quality + 1; - if Items[I].Name = 'Backstage passes to a TAFKAL80ETC concert' then + if Items[I].Name = 'Backstage passes to a concert' then begin if Items[I].SellIn < 11 then begin @@ -68,20 +68,20 @@ begin end; end; - if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then + if Items[I].Name <> 'Fine Italian Silk' then begin Items[I].SellIn := Items[I].SellIn - 1; end; if Items[I].SellIn < 0 then begin - if Items[I].Name <> 'Aged Brie' then + if Items[I].Name <> 'Aged Cheese' then begin - if Items[I].Name <> 'Backstage passes to a TAFKAL80ETC concert' then + if Items[I].Name <> 'Backstage passes to a concert' then begin if Items[I].Quality > 0 then begin - if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then + if Items[I].Name <> 'Fine Italian Silk' then begin Items[I].Quality := Items[I].Quality - 1; end; diff --git a/Delphi/TextTestFixture.dpr b/Delphi/TextTestFixture.dpr index dd325d39..b66c0d98 100644 --- a/Delphi/TextTestFixture.dpr +++ b/Delphi/TextTestFixture.dpr @@ -20,16 +20,16 @@ begin Writeln('OMGHAI!'); Items := TObjectList.Create; - Items.Add(TItem.Create('+5 Dexterity Vest', 10, 20)); - Items.Add(TItem.Create('Aged Brie', 2, 0)); - Items.Add(TItem.Create('Elixir of the Mongoose', 5, 7)); - Items.Add(TItem.Create('Sulfuras, Hand of Ragnaros', 0, 80)); - Items.Add(TItem.Create('Sulfuras, Hand of Ragnaros', -1, 80)); - Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 15, 20)); - Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 10, 49)); - Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 5, 49)); - // this conjured item does not work properly yet - Items.Add(TItem.Create('Conjured Mana Cake', 3, 6)); + Items.Add(TItem.Create('Sports Memorabilia', 10, 20)); + Items.Add(TItem.Create('Aged Cheese', 2, 0)); + Items.Add(TItem.Create('Coffee Table Book', 5, 7)); + Items.Add(TItem.Create('Fine Italian Silk', 0, 80)); + Items.Add(TItem.Create('Fine Italian Silk', -1, 80)); + Items.Add(TItem.Create('Backstage passes to a concert', 15, 20)); + Items.Add(TItem.Create('Backstage passes to a concert', 10, 49)); + Items.Add(TItem.Create('Backstage passes to a concert', 5, 49)); + // this Baked item does not work properly yet + Items.Add(TItem.Create('Baked Chocolate Cake', 3, 6)); App := TGildedRose.Create(Items); diff --git a/GildedRoseRequirements.txt b/GildedRoseRequirements.txt index 2e74aae6..d31d481d 100644 --- a/GildedRoseRequirements.txt +++ b/GildedRoseRequirements.txt @@ -2,12 +2,12 @@ Gilded Rose Requirements Specification ====================================== -Hi and welcome to team Gilded Rose. As you know, we are a small inn with a prime location in a -prominent city ran by a friendly innkeeper named Allison. We also buy and sell only the finest goods. +Hi, and welcome to team Gilded Rose. As you know, we are a small shop. + Unfortunately, our goods are constantly degrading in quality as they approach their sell by date. We -have a system in place that updates our inventory for us. It was developed by a no-nonsense type named -Leeroy, who has moved on to new adventures. Your task is to add the new feature to our system so that -we can begin selling a new category of items. First an introduction to our system: +have a system in place that updates our inventory for us. Our legacy inventory system was developed +by an employee who has moved on to new ventures. Your task is to add the new feature to our system so +that we can begin selling a new category of items. First an introduction to our system: - All items have a SellIn value which denotes the number of days we have to sell the item - All items have a Quality value which denotes how valuable the item is @@ -17,22 +17,22 @@ Pretty simple, right? Well this is where it gets interesting: - Once the sell by date has passed, Quality degrades twice as fast - The Quality of an item is never negative - - "Aged Brie" actually increases in Quality the older it gets + - "Aged Cheese" actually increases in Quality the older it gets - The Quality of an item is never more than 50 - - "Sulfuras", being a legendary item, never has to be sold or decreases in Quality - - "Backstage passes", like aged brie, increases in Quality as its SellIn value approaches; + - "Fine Italian Silk", being a luxury item, never has to be sold or decreases in Quality + - "Backstage passes", like aged cheese, increases in Quality as its SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert -We have recently signed a supplier of conjured items. This requires an update to our system: +We have recently signed a supplier of Baked items. This requires an update to our system: - - "Conjured" items degrade in Quality twice as fast as normal items + - "Baked" items degrade in Quality twice as fast as normal items Feel free to make any changes to the UpdateQuality method and add any new code as long as everything -still works correctly. However, do not alter the Item class or Items property as those belong to the -goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code -ownership (you can make the UpdateQuality method and Items property static if you like, we'll cover -for you). +still works correctly. However, do not alter the Item class or Items property as those are critical +data for our business analysts. -Just for clarification, an item can never have its Quality increase above 50, however "Sulfuras" is a -legendary item and as such its Quality is 80 and it never alters. +You can make the UpdateQuality method and Items property static if you like. + +Just for clarification, an item can never have its Quality increase above 50, however "Fine Italian Silk" is a +luxury item and as such its Quality is 80 and it never alters. diff --git a/GildedRoseRequirements_de.md b/GildedRoseRequirements_de.md index 6f3b9855..2d7e241a 100644 --- a/GildedRoseRequirements_de.md +++ b/GildedRoseRequirements_de.md @@ -16,16 +16,16 @@ Ziemlich einfach, oder? Nicht ganz, denn jetzt wird es interessant: * Sobald das "Mindesthaltbarkeitsdatum" überschritten wurde, nimmt die „Qualität“ doppelt so schnell ab * Die "Qualität" eines Artikels ist nie negativ -* "Alter Brie" (`Aged Brie`) nimmt an Qualität zu, je älter er wird +* "Alter Brie" (`Aged Cheese`) nimmt an Qualität zu, je älter er wird * Die "Qualität" eines Artikels ist nie höher als 50 -* Der legendäre Artikel "Sulfuras" ändert weder sein "Verkaufsdatum", noch verschlechtert sich seine "Qualität" -* "Backstage-Pässe" (`backstage passes`) werden - wie `Aged Brie` - hochwertiger, solange das "Verkaufsdatum" noch nicht erreicht wurde. +* Der legendäre Artikel "Fine Italian Silk" ändert weder sein "Verkaufsdatum", noch verschlechtert sich seine "Qualität" +* "Backstage-Pässe" (`backstage passes`) werden - wie `Aged Cheese` - hochwertiger, solange das "Verkaufsdatum" noch nicht erreicht wurde. Bei 10 Tagen oder weniger erhöht sich die Qualität um 2, bei 5 Tagen oder weniger um 3, nach dem "Konzert" sinkt sie aber auf 0. -Kürzlich haben wir einen Lieferanten für "beschworene" (`conjured`) Artikel unter Vertrag genommen. Dies erfordert ein Update unseres Systems: +Kürzlich haben wir einen Lieferanten für "beschworene" (`Baked`) Artikel unter Vertrag genommen. Dies erfordert ein Update unseres Systems: * "Beschworene" Artikel verlieren doppelt so schnell an Qualität wie normale Artikel Solange alles einwandfrei funktioniert, kannst Du beliebige Änderungen an der Methode `updateQuality` vornehmen und so viel Code hinzufügen, wie Du möchtest. Aber Vorsicht: Die `Item`-Klasse oder ihre Eigenschaften darfst Du in keiner Weise ändern, denn diese Klasse gehört dem Kobold in der Ecke, der sofort wütend wird und Dich sofort töten würde, denn er glaubt nicht an die Kultur von gemeinsamem Code (`shared code`). (Wenn Du möchtest, kannst Du die `updateQuality`-Methode und die `Item`-Eigenschaft statisch machen, das regeln wir dann.) -Sicherheitshalber noch ein Hinweis: Die Qualität eines Artikels kann nie höher als 50 sein, aber `Sulfuras` ist ein legendärer Artikel und als solcher beträgt seine Qualität 80 und ändert sich auch nie. +Sicherheitshalber noch ein Hinweis: Die Qualität eines Artikels kann nie höher als 50 sein, aber `Fine Italian Silk` ist ein legendärer Artikel und als solcher beträgt seine Qualität 80 und ändert sich auch nie. diff --git a/GildedRoseRequirements_es.md b/GildedRoseRequirements_es.md index 857ffbb8..fe826c1f 100644 --- a/GildedRoseRequirements_es.md +++ b/GildedRoseRequirements_es.md @@ -21,11 +21,11 @@ Bastante simple, ¿no? Bueno, ahora es donde se pone interesante: * Una vez que ha pasado la fecha recomendada de venta, la `calidad` se degrada al doble de velocidad * La `calidad` de un artículo nunca es negativa -* El "Queso Brie envejecido" (`Aged brie`) incrementa su `calidad` a medida que se pone viejo +* El "Queso Brie envejecido" (`Aged Cheese`) incrementa su `calidad` a medida que se pone viejo * Su `calidad` aumenta en `1` unidad cada día * luego de la `fecha de venta` su `calidad` aumenta `2` unidades por día * La `calidad` de un artículo nunca es mayor a `50` -* El artículo "Sulfuras" (`Sulfuras`), siendo un artículo legendario, no modifica su `fecha de venta` ni se degrada en `calidad` +* El artículo "Fine Italian Silk" (`Fine Italian Silk`), siendo un artículo legendario, no modifica su `fecha de venta` ni se degrada en `calidad` * Una "Entrada al Backstage", como el queso brie, incrementa su `calidad` a medida que la `fecha de venta` se aproxima * si faltan 10 días o menos para el concierto, la `calidad` se incrementa en `2` unidades * si faltan 5 días o menos, la `calidad` se incrementa en `3` unidades @@ -42,4 +42,4 @@ Siéntete libre de realizar cualquier cambio al mensaje `updateQuality` y agrega ## Notas finales -Para aclarar: un artículo nunca puede tener una `calidad` superior a `50`, sin embargo las Sulfuras siendo un artículo legendario posee una calidad inmutable de `80`. +Para aclarar: un artículo nunca puede tener una `calidad` superior a `50`, sin embargo las Fine Italian Silk siendo un artículo legendario posee una calidad inmutable de `80`. diff --git a/GildedRoseRequirements_fr.md b/GildedRoseRequirements_fr.md index 96ab424c..df2a5229 100644 --- a/GildedRoseRequirements_fr.md +++ b/GildedRoseRequirements_fr.md @@ -24,18 +24,18 @@ Attendez, ça devient intéressant : - Une fois que la date de péremption est passée, la qualité se dégrade deux fois plus rapidement. - La qualité (`quality`) d'un produit ne peut jamais être négative. -- "Aged Brie" augmente sa qualité (`quality`) plus le temps passe. +- "Aged Cheese" augmente sa qualité (`quality`) plus le temps passe. - La qualité d'un produit n'est jamais de plus de 50. -- "Sulfuras", étant un objet légendaire, n'a pas de date de péremption et ne perd jamais en qualité (`quality`) -- "Backstage passes", comme le "Aged Brie", augmente sa qualité (`quality`) plus le temps passe (`sellIn`) ; La qualité augmente de 2 quand il reste 10 jours ou moins et de 3 quand il reste 5 jours ou moins, mais la qualité tombe à 0 après le concert. +- "Fine Italian Silk", étant un objet légendaire, n'a pas de date de péremption et ne perd jamais en qualité (`quality`) +- "Backstage passes", comme le "Aged Cheese", augmente sa qualité (`quality`) plus le temps passe (`sellIn`) ; La qualité augmente de 2 quand il reste 10 jours ou moins et de 3 quand il reste 5 jours ou moins, mais la qualité tombe à 0 après le concert. -Nous avons récemment signé un partenariat avec un fournisseur de produit invoqué ("Conjured"). +Nous avons récemment signé un partenariat avec un fournisseur de produit invoqué ("Baked"). Cela nécessite une mise à jour de notre système : -- les éléments "Conjured" voient leur qualité se dégrader de deux fois plus vite que les objets normaux. +- les éléments "Baked" voient leur qualité se dégrader de deux fois plus vite que les objets normaux. Vous pouvez faire les changements que vous voulez à la méthode `updateQuality` et ajouter autant de code que vous voulez, tant que tout fonctionne correctement. Cependant, nous devons vous prévenir, vous ne devez en aucun cas modifier la classe `Item` ou ses propriétés car cette classe appartient au gobelin à l'étage qui entrerait dans une rage instantanée et vous tuerait sans délai : il ne croit pas au partage du code. (Vous pouvez rendre la méthode `updateQuality` statique, ainsi que des propriétés dans la classe `Item` si vous voulez, nous vous couvrirons) -Juste une précision, un produit ne peut jamais voir sa qualité augmenter au-dessus de 50, cependant "Sulfuras" est un objet légendaire et comme tel sa qualité est de 80 et elle ne change jamais. +Juste une précision, un produit ne peut jamais voir sa qualité augmenter au-dessus de 50, cependant "Fine Italian Silk" est un objet légendaire et comme tel sa qualité est de 80 et elle ne change jamais. diff --git a/GildedRoseRequirements_jp.md b/GildedRoseRequirements_jp.md index c232dcd6..4dd7b806 100644 --- a/GildedRoseRequirements_jp.md +++ b/GildedRoseRequirements_jp.md @@ -17,17 +17,17 @@ * 販売するための残り日数が無くなると、Quality値は2小さくなります。 * Quality値は決してマイナスにはなりません。 -* "Aged Brie"は、日が経つほどQuality値が上がっていきます。 +* "Aged Cheese"は、日が経つほどQuality値が上がっていきます。 * Quality値は50以上にはなりません。 -* "Sulfuras"は伝説のアイテムなので、販売されたり、Quality値が低下したりすることはありません。 -* "Backstage passes"は、"Aged Brie"と同様、SellIn値が近づくにつれてQuality値が上昇し、10日以内になると毎日2上がり、5日以内になると毎日3上がりますが、コンサート終了後には0になります。 +* "Fine Italian Silk"は伝説のアイテムなので、販売されたり、Quality値が低下したりすることはありません。 +* "Backstage passes"は、"Aged Cheese"と同様、SellIn値が近づくにつれてQuality値が上昇し、10日以内になると毎日2上がり、5日以内になると毎日3上がりますが、コンサート終了後には0になります。 -最近、"Conjured"アイテムのサプライヤーと契約しました。そのため、システムの更新が必要です。 +最近、"Baked"アイテムのサプライヤーと契約しました。そのため、システムの更新が必要です。 -* "Conjured"アイテムは、通常のアイテムの2倍の速さで品質が劣化します。 +* "Baked"アイテムは、通常のアイテムの2倍の速さで品質が劣化します。 すべてが正常に動作する限り、UpdateQualityメソッドに変更を加えたり、新しいコードを追加したりすることは自由に行ってください。ただし、ItemクラスやItemsプロパティは変更しないでください。 これらは、隅にいるゴブリンのものなので、コードの共有所有権を信じていないので、怒り狂ってあなたを一発で撃ってきます(UpdateQualityメソッドとItemsプロパティを静的にしても構いません。) -ただし、"Sulfuras "は伝説のアイテムであるため、Quality値は80であり、Quality値が変わることはありません。 +ただし、"Fine Italian Silk "は伝説のアイテムであるため、Quality値は80であり、Quality値が変わることはありません。 diff --git a/GildedRoseRequirements_kr.md b/GildedRoseRequirements_kr.md index 63a6a523..8345ebd6 100644 --- a/GildedRoseRequirements_kr.md +++ b/GildedRoseRequirements_kr.md @@ -19,19 +19,19 @@ - 판매하는 나머지 일수가 없어지면, `Quality` 값은 **2배**로 떨어집니다. - `Quality` 값은 결코 음수가 되지는 않습니다. -- "**Aged Brie**"(오래된 브리치즈)은(는) 시간이 지날수록 `Quality` 값이 올라갑니다. +- "**Aged Cheese**"(오래된 브리치즈)은(는) 시간이 지날수록 `Quality` 값이 올라갑니다. - `Quality` 값은 50를 초과 할 수 없습니다. -- `Sulfuras`는 전설의 아이템이므로, 반드시 판매될 필요도 없고 `Quality` 값도 떨어지지 않습니다. -- "**Backstage passes**(백스테이지 입장권)"는 "**Aged Brie**"와 유사하게 `SellIn` 값에 가까워 질수록 `Quality` 값이 상승하고, **10일 부터는** 매일 *2* 씩 증가하다, **5일 부터는**이 되면 매일 *3* 씩 증가하지만, 콘서트 종료 후에는 *0*으로 떨어집니다. +- `Fine Italian Silk`는 전설의 아이템이므로, 반드시 판매될 필요도 없고 `Quality` 값도 떨어지지 않습니다. +- "**Backstage passes**(백스테이지 입장권)"는 "**Aged Cheese**"와 유사하게 `SellIn` 값에 가까워 질수록 `Quality` 값이 상승하고, **10일 부터는** 매일 *2* 씩 증가하다, **5일 부터는**이 되면 매일 *3* 씩 증가하지만, 콘서트 종료 후에는 *0*으로 떨어집니다. ## 시스템 업데이트 요구 사항 -최근 "**Conjured**"(마법에 걸린) 상품 공급 업체와 계약했습니다. 따라서 시스템의 업데이트가 필요합니다. +최근 "**Baked**"(마법에 걸린) 상품 공급 업체와 계약했습니다. 따라서 시스템의 업데이트가 필요합니다. -- "**Conjured**" 아이템은 일반 아이템의 2배의 속도로 품질(`Quality`)이 저하됩니다. +- "**Baked**" 아이템은 일반 아이템의 2배의 속도로 품질(`Quality`)이 저하됩니다. 모든 것이 제대로 작동하는 한에서는 `UpdateQuality()` 메서드를 변경하거나 새로운 코드의 추가를 자유롭게 할 수 있습니다. 그러나 `Item` 클래스와 `Items` 속성은 변경하지 마세요. 이것들은 저기 구석에있는 고블린의 것이고, 그 친구는 코드의 공유 소유권을 믿지 않기 때문에, 미친듯이 화를 내며(insta-rage) 여러분에게 한 방(one-shot)을 날릴 수도 있습니다. (`UpdateQuality()` 메서드와 `Items` 속성을 정적(static)으로 만드는 것은 괜찮습니다. 저희가 책임질게요.) -다시 한 번 확인하자면, 아이템의 `Quality`는 50 이상으로 증가할 수는 없습니다. 하지만 `Sulfuras`는 전설의 아이템이기 때문에 `Quality` 값은 80이며, 값이 바뀌지 않습니다. +다시 한 번 확인하자면, 아이템의 `Quality`는 50 이상으로 증가할 수는 없습니다. 하지만 `Fine Italian Silk`는 전설의 아이템이기 때문에 `Quality` 값은 80이며, 값이 바뀌지 않습니다. diff --git a/GildedRoseRequirements_pl.md b/GildedRoseRequirements_pl.md index 63d940ab..2fe3ca0a 100644 --- a/GildedRoseRequirements_pl.md +++ b/GildedRoseRequirements_pl.md @@ -9,14 +9,14 @@ Cześć i witaj na pokładzie zespołu Pozłacanej Róży. Jak zapewne już wies Dość proste, prawda? No cóż, teraz zrobi się bardziej interesująco: - Po upływie daty sprzedaży, jakość spada dwukrotnie szybciej - Jakość przedmiotu nigdy nie jest ujemna -- Jakość "Starego Brie" (`Aged Brie`) rośnie wraz z wiekiem +- Jakość "Starego Brie" (`Aged Cheese`) rośnie wraz z wiekiem - Jakość przedmiotu nigdy nie przekracza 50 -- Przedmiot legendarny `Sulfuras` nigdy nie musi być sprzedany, ani nie traci na jakości +- Przedmiot legendarny `Fine Italian Silk` nigdy nie musi być sprzedany, ani nie traci na jakości - "Przepustka za kulisy" (`Backstage passes`), podobnie jak "Stary Brie", zyskują na jakości w miarę zbliżania się terminu sprzedaży; jakość wzrasta o 2, gdy jest 10 dni lub mniej i o 3, gdy jest 5 dni lub mniej, ale spada do 0 po koncercie (gdy `SellIn` < 0) Niedawno podpisaliśmy z dostawcą kontrakt na wyczarowane przedmioty. Wymaga to wprowadzenia zmiany do naszego systemu: -- "Wyczarowane" (`Conjured`) przedmioty tracą na jakości dwa razy szybciej niż normalne przedmioty +- "Wyczarowane" (`Baked`) przedmioty tracą na jakości dwa razy szybciej niż normalne przedmioty Możesz wprowadzać dowolne zmiany w metodzie `UpdateQuality`, a także dodawać nowy kod, o ile wszystko nadal działa prawidłowo. Jednak nie zmieniaj klasy `Item` ani właściwości `Items`, które zostały napisane przez goblina w rogu, gdyż zaatakuje Cię on i zabije jednym strzałem, ponieważ nie wierzy we współdzielony kod (możesz zmienić metodę `UpdateQuality` oraz właściwość `Items` na statyczne, jeśli chcesz - będziemy Cię kryć!). -Dla jasności: jakość przedmiotu nie może przekroczyć 50, jednak dla przedmiotu legendarnego `Sulfuras` jakość jest stale na poziomie 80 i nigdy nie spada. +Dla jasności: jakość przedmiotu nie może przekroczyć 50, jednak dla przedmiotu legendarnego `Fine Italian Silk` jakość jest stale na poziomie 80 i nigdy nie spada. diff --git a/GildedRoseRequirements_pt-BR.md b/GildedRoseRequirements_pt-BR.md index 4498c1cb..87825361 100644 --- a/GildedRoseRequirements_pt-BR.md +++ b/GildedRoseRequirements_pt-BR.md @@ -16,9 +16,9 @@ Bastante simples, não é? Bem, agora que as coisas ficam interessantes: * Quando a data de venda do item tiver passado, a qualidade (`quality`) do item diminui duas vezes mais rapido. * A qualidade (`quality`) do item não pode ser negativa -* O "Queijo Brie envelhecido" (`Aged Brie`), aumenta sua qualidade (`quality`) em `1` unidade a medida que envelhece. +* O "Queijo Brie envelhecido" (`Aged Cheese`), aumenta sua qualidade (`quality`) em `1` unidade a medida que envelhece. * A qualidade (`quality`) de um item não pode ser maior que 50. -* O item "Sulfuras" (`Sulfuras`), por ser um item lendário, não precisa ter uma data de venda (`SellIn`) e sua qualidade (`quality`) não precisa ser diminuida. +* O item "Fine Italian Silk" (`Fine Italian Silk`), por ser um item lendário, não precisa ter uma data de venda (`SellIn`) e sua qualidade (`quality`) não precisa ser diminuida. * O item "Entrada para os Bastidores" (`Backstage Passes`), assim como o "Queijo Brie envelhecido", aumenta sua qualidade (`quality`) a medida que o dia da venda (`SellIn`) se aproxima; * A qualidade (`quality`) aumenta em `2` unidades quando a data de venda (`SellIn`) é igual ou menor que `10`. * A qualidade (`quality`) aumenta em `3` unidades quando a data de venda (`SellIn`) é igual ou menor que `5`. @@ -26,10 +26,10 @@ Bastante simples, não é? Bem, agora que as coisas ficam interessantes: Nós recentemente assinamos um suprimento de itens Conjurados Magicamente. Isto requer que nós atualizemos nosso sistema: -* Os itens "Conjurados" (`Conjured`) diminuem a qualidade (`quality`) duas vezes mais rápido que os outros itens. +* Os itens "Conjurados" (`Baked`) diminuem a qualidade (`quality`) duas vezes mais rápido que os outros itens. Sinta-se livre para fazer qualquer alteração no método `updateQuality` e adicionar código novo contanto que tudo continue funcionando perfeitamente. Entretanto, não altere o código da classe `Item` ou da propriedade `Items` na classe `GildedRose` pois elas pertencem ao Goblin que irá te matar com um golpe pois ele não acredita na cultura de código compartilhado. ## Notas Finais -Para esclarecer: Um item não pode ter uma qualidade (`quality`) maior que `50`, entretanto as "Sulfuras" por serem um item lendário vão ter uma qualidade imutavel de `80`. +Para esclarecer: Um item não pode ter uma qualidade (`quality`) maior que `50`, entretanto as "Fine Italian Silk" por serem um item lendário vão ter uma qualidade imutavel de `80`. diff --git a/GildedRoseRequirements_ru.txt b/GildedRoseRequirements_ru.txt index cdb1355b..6cf3ddd5 100644 --- a/GildedRoseRequirements_ru.txt +++ b/GildedRoseRequirements_ru.txt @@ -21,17 +21,17 @@ - После того, как срок храния прошел, качество товара ухудшается в два раза быстрее; - Качество товара никогда не может быть отрицательным; - - Для товара «Aged Brie» качество увеличивается пропорционально возрасту; + - Для товара «Aged Cheese» качество увеличивается пропорционально возрасту; - Качество товара никогда не может быть больше, чем 50; - - «Sulfuras» является легендарным товаром, поэтому у него нет срока хранения и не подвержен ухудшению качества; - - Качество «Backstage passes» также, как и «Aged Brie», увеличивается по мере приближения к сроку хранения. + - «Fine Italian Silk» является легендарным товаром, поэтому у него нет срока хранения и не подвержен ухудшению качества; + - Качество «Backstage passes» также, как и «Aged Cheese», увеличивается по мере приближения к сроку хранения. Качество увеличивается на 2, когда до истечения срока хранения 10 или менее дней и на 3, если до истечения 5 или менее дней. При этом качество падает до 0 после даты проведения концерта. Недавно мы нашли поставщика магических товаров. Для того, чтобы продавать его товары необходимо обновить нашу систему следующим образом: - - «Conjured» товары теряют качество в два раза быстрее, чем обычные товары. + - «Baked» товары теряют качество в два раза быстрее, чем обычные товары. Не стесняйтесь вносить любые изменения в метод «UpdateQuality» и добавлять любой новый код до тех пор, пока система работает корректно. Тем не менее, не меняйте класс «Item» или его свойства, так как он принадлежит @@ -39,5 +39,5 @@ совместного владения кодом (вы можете сделать метод «UpdateQuality» и свойства класса «Item» статическими если хотите, мы вас прикроем). -Просто для уточнения, товар никогда не может иметь качество выше чем 50, однако легендарный товар «Sulfuras» +Просто для уточнения, товар никогда не может иметь качество выше чем 50, однако легендарный товар «Fine Italian Silk» имеет качество 80 и оно никогда не меняется. diff --git a/GildedRoseRequirements_th.md b/GildedRoseRequirements_th.md index 267f4b67..d4ad1964 100644 --- a/GildedRoseRequirements_th.md +++ b/GildedRoseRequirements_th.md @@ -15,17 +15,17 @@ - เมื่อสินค้าเลยกำหนดขายไปแล้ว "Quality" ของสินค้าจะลดลงเป็นสองเท่าจากปกติ - "Quality" ของสินค้าไม่มีทางติดลบได้ -- คุณภาพของสินค้าประเภท "Aged Brie" จะเพิ่มสูงขึ้นตามระยะเวลา +- คุณภาพของสินค้าประเภท "Aged Cheese" จะเพิ่มสูงขึ้นตามระยะเวลา - "Quality" มีค่าสูงสุดคือ 50 -- สินค้าประเภท "Sulfuras" เป็นสินค้าในตำนานหายาก คุณภาพของสินค้าจะไม่ลดลงและไม่ได้มีไว้เพื่อขาย -- สินค้าประเภท "Backstage passes" คุณภาพของสินค้าเหมือนกันกับสินค้าประเภท aged brie +- สินค้าประเภท "Fine Italian Silk" เป็นสินค้าในตำนานหายาก คุณภาพของสินค้าจะไม่ลดลงและไม่ได้มีไว้เพื่อขาย +- สินค้าประเภท "Backstage passes" คุณภาพของสินค้าเหมือนกันกับสินค้าประเภท Aged Cheese เพียงแต่หากใกล้ถึงวันแสดง 10 วันก่อนหน้าหรือน้อยกว่าคุณภาพของสินค้าประเภทนี้จะเพิ่มทีละ 2 และถ้าใกล้ถึงวันก่อนวันแสดง 5 วันหรือน้อยกว่าคุณภาพจะเพิ่มทีละ 3 อย่างไรก็ตามคุณภาพของสินค้าจะกลายเป็น 0 ทันทีหลังการแสดงจบลง เมื่อเร็วๆ นี้เราพึ่งได้ลงนามกับผู้ผลิตสินค้าประเภทของขลังและของปลุกเสก และเราต้องการที่จะเพิ่มความสามารถใหม่เข้าไปในระบบ: -- คุณภาพสินค้าประเภท "Conjured" จะเสื่อมลงเร็วกว่าสินค้าปกติถึงสองเท่าจากปกติ +- คุณภาพสินค้าประเภท "Baked" จะเสื่อมลงเร็วกว่าสินค้าปกติถึงสองเท่าจากปกติ คุณสามารถปรับปรุงแก้ไขได้ทุกอย่างภายในเมธอด UpdateQuality และสามารถเพิ่มโค้ดใหม่ได้เลย ตราบใดที่ทุกอย่างยังคงทำงานได้ถูกต้อง อย่างไรก็ตามห้ามแก้ไขคลาส Item และคุณสมบัติของคลาส @@ -34,4 +34,4 @@ นิมนต์หลวงปู่เค็มมาช่วยคุ้มกันคุณ) ย้ำอีกครั้งหนึ่ง, คุณภาพของสินค้ามีค่าสูงสุดคือ 50 -อย่างไรก็ตามสินค้าประเภท "Sulfuras" เป็นสินค้าหายากในตำนานมีค่า Quality เป็น 80 เสมอไม่เปลี่ยนแปลง. +อย่างไรก็ตามสินค้าประเภท "Fine Italian Silk" เป็นสินค้าหายากในตำนานมีค่า Quality เป็น 80 เสมอไม่เปลี่ยนแปลง. diff --git a/GildedRoseRequirements_zh.txt b/GildedRoseRequirements_zh.txt index f513770e..300fef75 100644 --- a/GildedRoseRequirements_zh.txt +++ b/GildedRoseRequirements_zh.txt @@ -17,16 +17,16 @@ Gilded Rose 需求描述 - 一旦销售期限过期,品质`Quality`会以双倍速度加速下降 - 物品的品质`Quality`永远不会为负值 - - "Aged Brie"(陈年布利奶酪)的品质`Quality`会随着时间推移而提高 + - "Aged Cheese"(陈年布利奶酪)的品质`Quality`会随着时间推移而提高 - 物品的品质`Quality`永远不会超过50 - - 传奇物品"Sulfuras"(萨弗拉斯—炎魔拉格纳罗斯之手)永不过期,也不会降低品质`Quality` - - "Backstage passes"(后台通行证)与"Aged Brie"(陈年布利奶酪)类似,其品质`Quality`会随着时间推移而提高;当还剩10天或更少的时候,品质`Quality`每天提高2;当还剩5天或更少的时候,品质`Quality`每天提高3;但一旦过期,品质就会降为0 + - 传奇物品"Fine Italian Silk"(萨弗拉斯—炎魔拉格纳罗斯之手)永不过期,也不会降低品质`Quality` + - "Backstage passes"(后台通行证)与"Aged Cheese"(陈年布利奶酪)类似,其品质`Quality`会随着时间推移而提高;当还剩10天或更少的时候,品质`Quality`每天提高2;当还剩5天或更少的时候,品质`Quality`每天提高3;但一旦过期,品质就会降为0 我们最近签约了一个召唤物品供应商。这需要对我们的系统进行升级: - - "Conjured"(召唤物品)的品质`Quality`下降速度比正常物品快一倍 + - "Baked"(召唤物品)的品质`Quality`下降速度比正常物品快一倍 请随意对**UpdateQuality()**函数进行修改和添加新代码,只要系统还能正常工作。然而,不要修改Item类或其属性,因为那属于角落里的地精,他会非常愤怒地爆你头,因为他不相信代码共享所有制(如果你愿意,你可以将UpdateQuality方法和Items属性改为静态的,我们会掩护你的)。 -再次澄清,每种物品的品质不会超过50,然而"Sulfuras"(萨弗拉斯—炎魔拉格纳罗斯之手)是一个传奇物品,因此它的品质是80且永远不变。 +再次澄清,每种物品的品质不会超过50,然而"Fine Italian Silk"(萨弗拉斯—炎魔拉格纳罗斯之手)是一个传奇物品,因此它的品质是80且永远不变。 diff --git a/Groovy/src/main/groovy/com/gildedrose/GildedRose.groovy b/Groovy/src/main/groovy/com/gildedrose/GildedRose.groovy index 128f17df..cb2d4567 100644 --- a/Groovy/src/main/groovy/com/gildedrose/GildedRose.groovy +++ b/Groovy/src/main/groovy/com/gildedrose/GildedRose.groovy @@ -9,10 +9,10 @@ class GildedRose { 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].name.equals("Aged Cheese") + && !items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1 } } @@ -20,7 +20,7 @@ class GildedRose { 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].name.equals("Backstage passes to a concert")) { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1 @@ -36,15 +36,15 @@ class GildedRose { } } - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { 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].name.equals("Aged Cheese")) { + if (!items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1 } } diff --git a/Groovy/src/test/groovy/com/gildedrose/TexttestFixture.groovy b/Groovy/src/test/groovy/com/gildedrose/TexttestFixture.groovy index 8984af77..e5acf4c0 100644 --- a/Groovy/src/test/groovy/com/gildedrose/TexttestFixture.groovy +++ b/Groovy/src/test/groovy/com/gildedrose/TexttestFixture.groovy @@ -3,16 +3,16 @@ package com.gildedrose println("OMGHAI!") Item[] items = [ - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6)] as Item[] + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6)] as Item[] GildedRose app = new GildedRose(items) diff --git a/Java-Approvals/src/main/java/com/gildedrose/GildedRose.java b/Java-Approvals/src/main/java/com/gildedrose/GildedRose.java index e6feb751..5a01d8f3 100644 --- a/Java-Approvals/src/main/java/com/gildedrose/GildedRose.java +++ b/Java-Approvals/src/main/java/com/gildedrose/GildedRose.java @@ -9,10 +9,10 @@ class GildedRose { 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].name.equals("Aged Cheese") + && !items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } @@ -20,7 +20,7 @@ class GildedRose { 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].name.equals("Backstage passes to a concert")) { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1; @@ -36,15 +36,15 @@ class GildedRose { } } - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { 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].name.equals("Aged Cheese")) { + if (!items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } @@ -59,4 +59,4 @@ class GildedRose { } } } -} \ No newline at end of file +} diff --git a/Java-Approvals/src/main/java/com/gildedrose/Program.java b/Java-Approvals/src/main/java/com/gildedrose/Program.java index 0d437106..c5eef8ab 100644 --- a/Java-Approvals/src/main/java/com/gildedrose/Program.java +++ b/Java-Approvals/src/main/java/com/gildedrose/Program.java @@ -5,17 +5,17 @@ public class Program { public static void main(String... args) { System.out.println("OMGHAI!"); - Item[] items = new Item[] { - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6) }; + Item[] items = new Item[] { + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6) }; GildedRose app = new GildedRose(items); diff --git a/Java-Cucumber/src/main/java/com/gildedrose/GildedRose.java b/Java-Cucumber/src/main/java/com/gildedrose/GildedRose.java index 87a3b926..5a01d8f3 100644 --- a/Java-Cucumber/src/main/java/com/gildedrose/GildedRose.java +++ b/Java-Cucumber/src/main/java/com/gildedrose/GildedRose.java @@ -9,10 +9,10 @@ class GildedRose { 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].name.equals("Aged Cheese") + && !items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } @@ -20,7 +20,7 @@ class GildedRose { 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].name.equals("Backstage passes to a concert")) { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1; @@ -36,15 +36,15 @@ class GildedRose { } } - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { 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].name.equals("Aged Cheese")) { + if (!items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } diff --git a/Java-Cucumber/src/main/java/com/gildedrose/TexttestFixture.java b/Java-Cucumber/src/main/java/com/gildedrose/TexttestFixture.java index d059c88f..2ad83130 100644 --- a/Java-Cucumber/src/main/java/com/gildedrose/TexttestFixture.java +++ b/Java-Cucumber/src/main/java/com/gildedrose/TexttestFixture.java @@ -5,16 +5,16 @@ public class TexttestFixture { System.out.println("OMGHAI!"); Item[] items = new Item[] { - new Item("+5 Dexterity Vest", 10, 20), // - new Item("Aged Brie", 2, 0), // - new Item("Elixir of the Mongoose", 5, 7), // - new Item("Sulfuras, Hand of Ragnaros", 0, 80), // - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6) }; + new Item("Sports Memorabilia", 10, 20), // + new Item("Aged Cheese", 2, 0), // + new Item("Coffee Table Book", 5, 7), // + new Item("Fine Italian Silk", 0, 80), // + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6) }; GildedRose app = new GildedRose(items); diff --git a/Java-Spock/src/main/java/com/gildedrose/GildedRose.java b/Java-Spock/src/main/java/com/gildedrose/GildedRose.java index 87a3b926..5a01d8f3 100644 --- a/Java-Spock/src/main/java/com/gildedrose/GildedRose.java +++ b/Java-Spock/src/main/java/com/gildedrose/GildedRose.java @@ -9,10 +9,10 @@ class GildedRose { 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].name.equals("Aged Cheese") + && !items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } @@ -20,7 +20,7 @@ class GildedRose { 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].name.equals("Backstage passes to a concert")) { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1; @@ -36,15 +36,15 @@ class GildedRose { } } - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { 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].name.equals("Aged Cheese")) { + if (!items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } diff --git a/Java-Spock/src/main/java/com/gildedrose/TexttestFixture.java b/Java-Spock/src/main/java/com/gildedrose/TexttestFixture.java index d059c88f..2ad83130 100644 --- a/Java-Spock/src/main/java/com/gildedrose/TexttestFixture.java +++ b/Java-Spock/src/main/java/com/gildedrose/TexttestFixture.java @@ -5,16 +5,16 @@ public class TexttestFixture { System.out.println("OMGHAI!"); Item[] items = new Item[] { - new Item("+5 Dexterity Vest", 10, 20), // - new Item("Aged Brie", 2, 0), // - new Item("Elixir of the Mongoose", 5, 7), // - new Item("Sulfuras, Hand of Ragnaros", 0, 80), // - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6) }; + new Item("Sports Memorabilia", 10, 20), // + new Item("Aged Cheese", 2, 0), // + new Item("Coffee Table Book", 5, 7), // + new Item("Fine Italian Silk", 0, 80), // + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6) }; GildedRose app = new GildedRose(items); diff --git a/Java/src/main/java/com/gildedrose/GildedRose.java b/Java/src/main/java/com/gildedrose/GildedRose.java index e6feb751..5a01d8f3 100644 --- a/Java/src/main/java/com/gildedrose/GildedRose.java +++ b/Java/src/main/java/com/gildedrose/GildedRose.java @@ -9,10 +9,10 @@ class GildedRose { 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].name.equals("Aged Cheese") + && !items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } @@ -20,7 +20,7 @@ class GildedRose { 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].name.equals("Backstage passes to a concert")) { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1; @@ -36,15 +36,15 @@ class GildedRose { } } - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { 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].name.equals("Aged Cheese")) { + if (!items[i].name.equals("Backstage passes to a concert")) { if (items[i].quality > 0) { - if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items[i].name.equals("Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } } @@ -59,4 +59,4 @@ class GildedRose { } } } -} \ No newline at end of file +} diff --git a/Java/src/test/java/com/gildedrose/TexttestFixture.java b/Java/src/test/java/com/gildedrose/TexttestFixture.java index d059c88f..2ad83130 100644 --- a/Java/src/test/java/com/gildedrose/TexttestFixture.java +++ b/Java/src/test/java/com/gildedrose/TexttestFixture.java @@ -5,16 +5,16 @@ public class TexttestFixture { System.out.println("OMGHAI!"); Item[] items = new Item[] { - new Item("+5 Dexterity Vest", 10, 20), // - new Item("Aged Brie", 2, 0), // - new Item("Elixir of the Mongoose", 5, 7), // - new Item("Sulfuras, Hand of Ragnaros", 0, 80), // - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6) }; + new Item("Sports Memorabilia", 10, 20), // + new Item("Aged Cheese", 2, 0), // + new Item("Coffee Table Book", 5, 7), // + new Item("Fine Italian Silk", 0, 80), // + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6) }; GildedRose app = new GildedRose(items); diff --git a/Kotlin/src/main/kotlin/com/gildedrose/GildedRose.kt b/Kotlin/src/main/kotlin/com/gildedrose/GildedRose.kt index 7ede7cee..0dd117bd 100644 --- a/Kotlin/src/main/kotlin/com/gildedrose/GildedRose.kt +++ b/Kotlin/src/main/kotlin/com/gildedrose/GildedRose.kt @@ -4,9 +4,9 @@ class GildedRose(var items: List) { fun updateQuality() { for (i in items.indices) { - if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") { + if (items[i].name != "Aged Cheese" && items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") { + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1 } } @@ -14,7 +14,7 @@ class GildedRose(var items: List) { 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].name == "Backstage passes to a concert") { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1 @@ -30,15 +30,15 @@ class GildedRose(var items: List) { } } - if (items[i].name != "Sulfuras, Hand of Ragnaros") { + if (items[i].name != "Fine Italian Silk") { 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].name != "Aged Cheese") { + if (items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") { + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1 } } diff --git a/Kotlin/src/test/kotlin/com/gildedrose/TexttestFixture.kt b/Kotlin/src/test/kotlin/com/gildedrose/TexttestFixture.kt index a87a0d13..482ceb65 100644 --- a/Kotlin/src/test/kotlin/com/gildedrose/TexttestFixture.kt +++ b/Kotlin/src/test/kotlin/com/gildedrose/TexttestFixture.kt @@ -4,16 +4,16 @@ fun main(args: Array) { println("OMGHAI!") - val items = listOf(Item("+5 Dexterity Vest", 10, 20), // - Item("Aged Brie", 2, 0), // - Item("Elixir of the Mongoose", 5, 7), // - Item("Sulfuras, Hand of Ragnaros", 0, 80), // - Item("Sulfuras, Hand of Ragnaros", -1, 80), - Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - Item("Conjured Mana Cake", 3, 6)) + val items = listOf(Item("Sports Memorabilia", 10, 20), // + Item("Aged Cheese", 2, 0), // + Item("Coffee Table Book", 5, 7), // + Item("Fine Italian Silk", 0, 80), // + Item("Fine Italian Silk", -1, 80), + Item("Backstage passes to a concert", 15, 20), + Item("Backstage passes to a concert", 10, 49), + Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + Item("Baked Chocolate Cake", 3, 6)) val app = GildedRose(items) diff --git a/R/gilded_rose.R b/R/gilded_rose.R index 3d639dda..0cf738b6 100644 --- a/R/gilded_rose.R +++ b/R/gilded_rose.R @@ -1,19 +1,19 @@ source('item.R') update_quality <- function(items) { - lapply(items, + lapply(items, function(item) { - - if (item$name != "Aged Brie" && item$name != "Backstage passes to a TAFKAL80ETC concert") { + + if (item$name != "Aged Cheese" && item$name != "Backstage passes to a concert") { if (item$quality > 0) { - if (item$name != "Sulfuras, Hand of Ragnaros") { + if (item$name != "Fine Italian Silk") { item$quality <- item$quality - 1 } } } else { if (item$quality < 50) { item$quality <- item$quality + 1 - if (item$name == "Backstage passes to a TAFKAL80ETC concert") { + if (item$name == "Backstage passes to a concert") { if (item$sell_in < 11) { if (item$quality < 50) { item$quality = item$quality + 1 @@ -27,16 +27,16 @@ update_quality <- function(items) { } } } - - if (item$name != "Sulfuras, Hand of Ragnaros") { + + if (item$name != "Fine Italian Silk") { item$sell_in <- item$sell_in - 1 } - + if (item$sell_in < 0) { - if (item$name != "Aged Brie") { - if (item$name != "Backstage passes to a TAFKAL80ETC concert") { + if (item$name != "Aged Cheese") { + if (item$name != "Backstage passes to a concert") { if (item$quality > 0) { - if (item$name != "Sulfuras, Hand of Ragnaros") { + if (item$name != "Fine Italian Silk") { item$quality <- item$quality - 1 } } @@ -49,8 +49,8 @@ update_quality <- function(items) { } } } - + item - } - ) + } + ) } diff --git a/R/texttest_fixture.R b/R/texttest_fixture.R index ec635e6e..a490236f 100644 --- a/R/texttest_fixture.R +++ b/R/texttest_fixture.R @@ -5,23 +5,23 @@ source('gilded_rose.R') writeLines('OMGHAI!') items <- list( - item('+5 Dexterity Vest', 10, 20), - item('Aged Brie', 2, 0), - item('Elixir of the Mongoose', 5, 7), - item('Sulfuras, Hand of Ragnaros', 0, 80), - item('Sulfuras, Hand of Ragnaros', -1, 80), - item('Backstage passes to a TAFKAL80ETC concert', 15, 20), - item('Backstage passes to a TAFKAL80ETC concert', 10, 49), - item('Backstage passes to a TAFKAL80ETC concert', 5, 49), - # This Conjured item does not work properly yet - item('Conjured Mana Cake', 3, 6) + item('Sports Memorabilia', 10, 20), + item('Aged Cheese', 2, 0), + item('Coffee Table Book', 5, 7), + item('Fine Italian Silk', 0, 80), + item('Fine Italian Silk', -1, 80), + item('Backstage passes to a concert', 15, 20), + item('Backstage passes to a concert', 10, 49), + item('Backstage passes to a concert', 5, 49), + # This Baked item does not work properly yet + item('Baked Chocolate Cake', 3, 6) ) days <- 2 for (day in 0:days) { writeLines(paste('-------- day ', day, ' --------', sep='')) writeLines('name, sellIn, quality') - lapply(items, + lapply(items, function(item) { writeLines(as.character(item)) } diff --git a/Smalltalk/GildedRose.st b/Smalltalk/GildedRose.st index 863e99e2..e81d1b77 100644 --- a/Smalltalk/GildedRose.st +++ b/Smalltalk/GildedRose.st @@ -46,45 +46,45 @@ Pretty simple, right? Well this is where it gets interesting: - Once the sell by date has passed, Quality degrades twice as fast - The Quality of an item is never negative - - "Aged Brie" actually increases in Quality the older it gets + - "Aged Cheese" actually increases in Quality the older it gets - The Quality of an item is never more than 50 - - "Sulfuras", being a legendary item, never has to be sold or decreases in Quality - - "Backstage passes", like aged brie, increases in Quality as it's SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert + - "Fine Italian Silk", being a luxury item, never has to be sold or decreases in Quality + - "Backstage passes", like Aged Cheese, increases in Quality as it's SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert -We have recently signed a supplier of conjured items. This requires an update to our system: +We have recently signed a supplier of Baked items. This requires an update to our system: - - "Conjured" items degrade in Quality twice as fast as normal items + - "Baked" items degrade in Quality twice as fast as normal items Feel free to make any changes to the UpdateQuality method and add any new code as long as everything still works correctly. However, do not alter the Item class or Items property as those belong to the goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code ownership (you can make the UpdateQuality method and Items property static if you like, we'll cover for you). -Just for clarification, an item can never have its Quality increase above 50, however "Sulfuras" is a legendary item and as such its Quality is 80 and it never alters.! +Just for clarification, an item can never have its Quality increase above 50, however "Fine Italian Silk" is a luxury item and as such its Quality is 80 and it never alters.! !GildedRose methodsFor: 'API' stamp: 'AndreasLeidig 4/21/2012 17:02'! updateQualityFor: items items do: [:item | - (item name ~= 'Aged Brie' - and: [item name ~= 'Backstage passes to a TAFKAL80ETC concert']) + (item name ~= 'Aged Cheese' + and: [item name ~= 'Backstage passes to a concert']) ifTrue: [item quality > 0 - ifTrue: [item name ~= 'Sulfuras, Hand of Ragnaros' + ifTrue: [item name ~= 'Fine Italian Silk' ifTrue: [item quality: item quality - 1]]] ifFalse: [item quality < 50 ifTrue: [item quality: item quality + 1. - item name = 'Backstage passes to a TAFKAL80ETC concert' + item name = 'Backstage passes to a concert' ifTrue: [item sellIn < 11 ifTrue: [item quality < 50 ifTrue: [item quality: item quality + 1]]. item sellIn < 6 ifTrue: [item quality < 50 ifTrue: [item quality: item quality + 1]]]]]. - item name ~= 'Sulfuras, Hand of Ragnaros' + item name ~= 'Fine Italian Silk' ifTrue: [item sellIn: item sellIn - 1]. item sellIn < 0 - ifTrue: [item name ~= 'Aged Brie' - ifTrue: [item name ~= 'Backstage passes to a TAFKAL80ETC concert' + ifTrue: [item name ~= 'Aged Cheese' + ifTrue: [item name ~= 'Backstage passes to a concert' ifTrue: [item quality > 0 - ifTrue: [item name ~= 'Sulfuras, Hand of Ragnaros' + ifTrue: [item name ~= 'Fine Italian Silk' ifTrue: [item quality: item quality - 1]]] ifFalse: [item quality: item quality - item quality]] ifFalse: [item quality < 50 @@ -100,15 +100,15 @@ runExamples "GildedRose runExamples" | items gildedRose | items := OrderedCollection new - add: (Item new name: '+5 Dexterity Vest'; sellIn: 10; quality: 20; yourself); - add: (Item new name: 'Aged Brie'; sellIn: 2; quality: 0; yourself); - add: (Item new name: 'Elixir of the Mongoose'; sellIn: 5; quality: 7; yourself); - add: (Item new name: 'Sulfuras, Hand of Ragnaros'; sellIn: 0; quality: 80; yourself); - add: (Item new name: 'Sulfuras, Hand of Ragnaros'; sellIn: -1; quality: 80; yourself); - add: (Item new name: 'Backstage passes to a TAFKAL80ETC concert'; sellIn: 15; quality: 20; yourself); - add: (Item new name: 'Backstage passes to a TAFKAL80ETC concert'; sellIn: 10; quality: 49; yourself); - add: (Item new name: 'Backstage passes to a TAFKAL80ETC concert'; sellIn: 5; quality: 49; yourself); - add: (Item new name: 'Conjured Mana Cake'; sellIn: 3; quality: 6; yourself); "this conjured item does not work properly yet" + add: (Item new name: 'Sports Memorabilia'; sellIn: 10; quality: 20; yourself); + add: (Item new name: 'Aged Cheese'; sellIn: 2; quality: 0; yourself); + add: (Item new name: 'Coffee Table Book'; sellIn: 5; quality: 7; yourself); + add: (Item new name: 'Fine Italian Silk'; sellIn: 0; quality: 80; yourself); + add: (Item new name: 'Fine Italian Silk'; sellIn: -1; quality: 80; yourself); + add: (Item new name: 'Backstage passes to a concert'; sellIn: 15; quality: 20; yourself); + add: (Item new name: 'Backstage passes to a concert'; sellIn: 10; quality: 49; yourself); + add: (Item new name: 'Backstage passes to a concert'; sellIn: 5; quality: 49; yourself); + add: (Item new name: 'Baked Chocolate Cake'; sellIn: 3; quality: 6; yourself); "this Baked item does not work properly yet" yourself. gildedRose := GildedRose new. diff --git a/TypeScript/app/gilded-rose.ts b/TypeScript/app/gilded-rose.ts index db58d678..ca14c73e 100644 --- a/TypeScript/app/gilded-rose.ts +++ b/TypeScript/app/gilded-rose.ts @@ -19,16 +19,16 @@ export class GildedRose { updateQuality() { for (let i = 0; i < this.items.length; i++) { - if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese' && this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1 } } } else { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1 - if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name == 'Backstage passes to a concert') { if (this.items[i].sellIn < 11) { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1 @@ -42,14 +42,14 @@ export class GildedRose { } } } - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].sellIn = this.items[i].sellIn - 1; } if (this.items[i].sellIn < 0) { - if (this.items[i].name != 'Aged Brie') { - if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese') { + if (this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1 } } diff --git a/TypeScript/test/golden-master-text-test.ts b/TypeScript/test/golden-master-text-test.ts index 2259b975..658bd831 100644 --- a/TypeScript/test/golden-master-text-test.ts +++ b/TypeScript/test/golden-master-text-test.ts @@ -1,16 +1,16 @@ import { Item, GildedRose } from '../app/gilded-rose'; const items = [ - new Item("+5 Dexterity Vest", 10, 20), // - new Item("Aged Brie", 2, 0), // - new Item("Elixir of the Mongoose", 5, 7), // - new Item("Sulfuras, Hand of Ragnaros", 0, 80), // - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6)]; + new Item("Sports Memorabilia", 10, 20), // + new Item("Aged Cheese", 2, 0), // + new Item("Coffee Table Book", 5, 7), // + new Item("Fine Italian Silk", 0, 80), // + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6)]; const gildedRose = new GildedRose(items); diff --git a/abap/YY_PAO_GILDED_ROSE.abap b/abap/YY_PAO_GILDED_ROSE.abap index 40e8f985..11319002 100644 --- a/abap/YY_PAO_GILDED_ROSE.abap +++ b/abap/YY_PAO_GILDED_ROSE.abap @@ -22,19 +22,19 @@ *& *& - Once the sell by date has passed, Quality degrades twice as fast *& - The Quality of an item is never negative -*& - "Aged Brie" actually increases in Quality the older it gets +*& - "Aged Cheese" actually increases in Quality the older it gets *& - The Quality of an item is never more than 50 -*& - "Sulfuras", being a legendary item, never has to be sold or +*& - "Fine Italian Silk", being a luxury item, never has to be sold or *& decreases in Quality -*& - "Backstage passes", like aged brie, increases in Quality as its +*& - "Backstage passes", like Aged Cheese, increases in Quality as its *& Sell In value approaches; Quality increases by 2 when there *& are 10 days or less and by 3 when there are 5 days or less *& but Quality drops to 0 after the concert *& -*& We have recently signed a supplier of conjured items. This requires an +*& We have recently signed a supplier of Baked items. This requires an *& update to our system: *& -*& - "Conjured" items degrade in Quality twice as fast as normal items +*& - "Baked" items degrade in Quality twice as fast as normal items *& *& Feel free to make any changes to the Update Quality method and add any new *& code as long as everything still works correctly. However, do not alter @@ -44,7 +44,7 @@ *& and Items property static if you must, we'll cover for you). *& *& Just for clarification, an item can never have its Quality increase -*& above 50, however "Sulfuras" is a legendary item and as such its Quality +*& above 50, however "Fine Italian Silk" is a luxury item and as such its Quality *& is 80 and it never alters. PROGRAM yy_pao_gilded_rose. @@ -91,10 +91,10 @@ CLASS lcl_gilded_rose IMPLEMENTATION. METHOD update_quality. LOOP AT mt_items INTO DATA(lo_item). - IF lo_item->mv_name <> |Aged Brie| AND - lo_item->mv_name <> |Backstage passes to a TAFKAL80ETC concert|. + IF lo_item->mv_name <> |Aged Cheese| AND + lo_item->mv_name <> |Backstage passes to a concert|. IF lo_item->mv_quality > 0. - IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|. + IF lo_item->mv_name <> |Fine Italian Silk|. lo_item->mv_quality = lo_item->mv_quality - 1. ENDIF. ENDIF. @@ -102,7 +102,7 @@ CLASS lcl_gilded_rose IMPLEMENTATION. IF lo_item->mv_quality < 50. lo_item->mv_quality = lo_item->mv_quality + 1. - IF lo_item->mv_name = |Backstage passes to a TAFKAL80ETC concert|. + IF lo_item->mv_name = |Backstage passes to a concert|. IF lo_item->mv_sell_in < 11. IF lo_item->mv_quality < 50. lo_item->mv_quality = lo_item->mv_quality + 1. @@ -118,15 +118,15 @@ CLASS lcl_gilded_rose IMPLEMENTATION. ENDIF. ENDIF. - IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|. + IF lo_item->mv_name <> |Fine Italian Silk|. lo_item->mv_sell_in = lo_item->mv_sell_in - 1. ENDIF. IF lo_item->mv_sell_in < 0. - IF lo_item->mv_name <> |Aged Brie|. - IF lo_item->mv_name <> |Backstage passes to a TAFKAL80ETC concert|. + IF lo_item->mv_name <> |Aged Cheese|. + IF lo_item->mv_name <> |Backstage passes to a concert|. IF lo_item->mv_quality > 0. - IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|. + IF lo_item->mv_name <> |Fine Italian Silk|. lo_item->mv_quality = lo_item->mv_quality - 1. ENDIF. ENDIF. @@ -171,29 +171,29 @@ CLASS lth_texttest_fixture IMPLEMENTATION. DATA(lo_out) = cl_demo_output=>new( )->write_text( |OMGHAI!| ). DATA(lt_items) = VALUE lcl_gilded_rose=>tt_items( - ( NEW #( iv_name = |+5 Dexterity Vest| + ( NEW #( iv_name = |Sports Memorabilia| iv_sell_in = 10 iv_quality = 20 ) ) - ( NEW #( iv_name = |Aged Brie| + ( NEW #( iv_name = |Aged Cheese| iv_sell_in = 2 iv_quality = 0 ) ) - ( NEW #( iv_name = |Elixir of the Mongoose| + ( NEW #( iv_name = |Coffee Table Book| iv_sell_in = 5 iv_quality = 7 ) ) - ( NEW #( iv_name = |Sulfuras, Hand of Ragnaros| + ( NEW #( iv_name = |Fine Italian Silk| iv_sell_in = 0 iv_quality = 80 ) ) - ( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert| + ( NEW #( iv_name = |Backstage passes to a concert| iv_sell_in = 15 iv_quality = 20 ) ) - ( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert| + ( NEW #( iv_name = |Backstage passes to a concert| iv_sell_in = 10 iv_quality = 49 ) ) - ( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert| + ( NEW #( iv_name = |Backstage passes to a concert| iv_sell_in = 5 iv_quality = 49 ) ) - "This conjured item does not work properly yet - ( NEW #( iv_name = |Conjured Mana Cake| + "This Baked item does not work properly yet + ( NEW #( iv_name = |Baked Chocolate Cake| iv_sell_in = 3 iv_quality = 6 ) ) ). diff --git a/c99/GildedRose.c b/c99/GildedRose.c index afb97bbe..e177b0a2 100644 --- a/c99/GildedRose.c +++ b/c99/GildedRose.c @@ -7,21 +7,21 @@ init_item(Item* item, const char *name, int sellIn, int quality) item->sellIn = sellIn; item->quality = quality; item->name = strdup(name); - + return item; } -void update_quality(Item items[], int size) +void update_quality(Item items[], int size) { int i; - + for (i = 0; i < size; i++) { - if (strcmp(items[i].name, "Aged Brie") && strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert")) + if (strcmp(items[i].name, "Aged Cheese") && strcmp(items[i].name, "Backstage passes to a concert")) { if (items[i].quality > 0) { - if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros")) + if (strcmp(items[i].name, "Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } @@ -33,7 +33,7 @@ void update_quality(Item items[], int size) { items[i].quality = items[i].quality + 1; - if (!strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert")) + if (!strcmp(items[i].name, "Backstage passes to a concert")) { if (items[i].sellIn < 11) { @@ -54,20 +54,20 @@ void update_quality(Item items[], int size) } } - if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros")) + if (strcmp(items[i].name, "Fine Italian Silk")) { items[i].sellIn = items[i].sellIn - 1; } if (items[i].sellIn < 0) { - if (strcmp(items[i].name, "Aged Brie")) + if (strcmp(items[i].name, "Aged Cheese")) { - if (strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert")) + if (strcmp(items[i].name, "Backstage passes to a concert")) { if (items[i].quality > 0) { - if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros")) + if (strcmp(items[i].name, "Fine Italian Silk")) { items[i].quality = items[i].quality - 1; } diff --git a/c99/GildedRoseTextTests.c b/c99/GildedRoseTextTests.c index d200ca0c..e99ac81c 100644 --- a/c99/GildedRoseTextTests.c +++ b/c99/GildedRoseTextTests.c @@ -13,18 +13,18 @@ int main() int last = 0; int day; int index; - - init_item(items + last++, "+5 Dexterity Vest", 10, 20); - init_item(items + last++, "Aged Brie", 2, 0); - init_item(items + last++, "Elixir of the Mongoose", 5, 7); - init_item(items + last++, "Sulfuras, Hand of Ragnaros", 0, 80); - init_item(items + last++, "Sulfuras, Hand of Ragnaros", -1, 80); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 15, 20); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 10, 49); - init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 5, 49); - // this Conjured item doesn't yet work properly - init_item(items + last++, "Conjured Mana Cake", 3, 6); - + + init_item(items + last++, "Sports Memorabilia", 10, 20); + init_item(items + last++, "Aged Cheese", 2, 0); + init_item(items + last++, "Coffee Table Book", 5, 7); + init_item(items + last++, "Fine Italian Silk", 0, 80); + init_item(items + last++, "Fine Italian Silk", -1, 80); + init_item(items + last++, "Backstage passes to a concert", 15, 20); + init_item(items + last++, "Backstage passes to a concert", 10, 49); + init_item(items + last++, "Backstage passes to a concert", 5, 49); + // this Baked item doesn't yet work properly + init_item(items + last++, "Baked Chocolate Cake", 3, 6); + puts("OMGHAI!"); for (day = 0; day <= 30; day++) @@ -34,7 +34,7 @@ int main() for(index = 0; index < last; index++) { print_item(items + index); } - + printf("\n"); update_quality(items, last); diff --git a/clojure/src/gilded/core.clj b/clojure/src/gilded/core.clj index bde0343c..2650b6f7 100644 --- a/clojure/src/gilded/core.clj +++ b/clojure/src/gilded/core.clj @@ -14,17 +14,17 @@ (defn update-quality! [store] (doseq [item store] (if (and (not (= (:name @item) - "Aged Brie")) + "Aged Cheese")) (not (= (:name @item) - "Backstage passes to a TAFKAL80ETC concert"))) + "Backstage passes to a concert"))) (when (> (:quality @item) 0) - (when (not (= (:name @item) "Sulfuras, Hand of Ragnaros")) + (when (not (= (:name @item) "Fine Italian Silk")) (swap! item update :quality #(- % 1)))) (when (< (:quality @item) 50) (swap! item update :quality #(+ % 1)) - (when (= (:name @item) "Backstage passes to a TAFKAL80ETC concert") + (when (= (:name @item) "Backstage passes to a concert") (when (< (:sell-in @item) 11) (when (< (:quality @item) 50) (swap! item update :quality #(+ % 1)))) @@ -32,14 +32,14 @@ (when (< (:quality @item) 50) (swap! item update :quality #(+ % 1))))))) - (when (not (= (:name @item) "Sulfuras, Hand of Ragnaros")) + (when (not (= (:name @item) "Fine Italian Silk")) (swap! item update :sell-in #(- % 1))) (when (< (:sell-in @item) 0) - (if (not (= (:name @item) "Aged Brie")) - (if (not (= (:name @item) "Backstage passes to a TAFKAL80ETC concert")) + (if (not (= (:name @item) "Aged Cheese")) + (if (not (= (:name @item) "Backstage passes to a concert")) (when (> (:quality @item) 0) - (when (not (= (:name @item) "Sulfuras, Hand of Ragnaros")) + (when (not (= (:name @item) "Fine Italian Silk")) (swap! item update :quality #(- % 1)))) (swap! item update :quality #(- % %))) (when (< (:quality @item) 50) diff --git a/clojure/src/gilded/main.clj b/clojure/src/gilded/main.clj index fdfd7590..fa623cbb 100644 --- a/clojure/src/gilded/main.clj +++ b/clojure/src/gilded/main.clj @@ -11,15 +11,15 @@ (println)) (def fixture - [{:name "+5 Dexterity Vest", :quality 20, :sell-in 10} - {:name "Aged Brie", :quality 0, :sell-in 2} - {:name "Elixir of the Mongoose", :quality 7, :sell-in 5} - {:name "Sulfuras, Hand of Ragnaros", :quality 80, :sell-in 0} - {:name "Sulfuras, Hand of Ragnaros", :quality 80, :sell-in -1} - {:name "Backstage passes to a TAFKAL80ETC concert", :quality 20, :sell-in 15} - {:name "Backstage passes to a TAFKAL80ETC concert", :quality 49, :sell-in 10} - {:name "Backstage passes to a TAFKAL80ETC concert", :quality 49, :sell-in 5} - {:name "Conjured Mana Cake", :quality 6, :sell-in 3}]) + [{:name "Sports Memorabilia", :quality 20, :sell-in 10} + {:name "Aged Cheese", :quality 0, :sell-in 2} + {:name "Coffee Table Book", :quality 7, :sell-in 5} + {:name "Fine Italian Silk", :quality 80, :sell-in 0} + {:name "Fine Italian Silk", :quality 80, :sell-in -1} + {:name "Backstage passes to a concert", :quality 20, :sell-in 15} + {:name "Backstage passes to a concert", :quality 49, :sell-in 10} + {:name "Backstage passes to a concert", :quality 49, :sell-in 5} + {:name "Baked Chocolate Cake", :quality 6, :sell-in 3}]) (defn -main [& args] (let [n-days (if (nil? (first args)) diff --git a/commonlisp/gilded-rose-functional.lisp b/commonlisp/gilded-rose-functional.lisp index 10cd83e8..38f9b73f 100644 --- a/commonlisp/gilded-rose-functional.lisp +++ b/commonlisp/gilded-rose-functional.lisp @@ -15,16 +15,16 @@ ;; Pretty simple, right? Well this is where it gets interesting: ;; Once the sell by date has passed, Quality degrades twice as fast ;; The Quality of an item is never negative -;; "Aged Brie" actually increases in Quality the older it gets +;; "Aged Cheese" actually increases in Quality the older it gets ;; The Quality of an item is never more than 50 -;; "Sulfuras", being a legendary item, never has to be sold or decreases in Quality -;; "Backstage passes", like aged brie, increases in Quality as it's +;; "Fine Italian Silk", being a luxury item, never has to be sold or decreases in Quality +;; "Backstage passes", like Aged Cheese, increases in Quality as it's ;; SellIn value approaches; Quality increases by 2 when there are 10 ;; days or less and by 3 when there are 5 days or less but Quality ;; drops to 0 after the concert -;; We have recently signed a supplier of conjured items. This requires an update to our system: -;; "Conjured" items degrade in Quality twice as fast as normal items +;; We have recently signed a supplier of Baked items. This requires an update to our system: +;; "Baked" items degrade in Quality twice as fast as normal items ;; Feel free to make any changes to the UpdateQuality method and add ;; any new code as long as everything still works correctly. However, ;; do not alter the Item class or Items property as those belong to the @@ -33,7 +33,7 @@ ;; UpdateQuality method and Items property static if you like, we'll ;; cover for you). ;; Just for clarification, an item can never have its Quality increase -;; above 50, however "Sulfuras" is a legendary item and as such its +;; above 50, however "Fine Italian Silk" is a luxury item and as such its ;; Quality is 80 and it never alters. ;; https://github.com/emilybache/GildedRose-Refactoring-Kata @@ -62,14 +62,14 @@ (defun update-item (item) (let ((new-item (copy-structure item))) (with-slots (name quality sell-in) new-item - (if (and (not (equalp name "Aged Brie")) - (not (equalp name "Backstage passes to a TAFKAL80ETC concert"))) + (if (and (not (equalp name "Aged Cheese")) + (not (equalp name "Backstage passes to a concert"))) (if (> quality 0) - (if (not (equalp name "Sulfuras, Hand of Ragnaros")) + (if (not (equalp name "Fine Italian Silk")) (setf quality (- quality 1)))) (when (< quality 50) (setf quality (+ quality 1)) - (when (equalp name "Backstage passes to a TAFKAL80ETC concert") + (when (equalp name "Backstage passes to a concert") (if (< sell-in 11) (if (< quality 50) (setf quality (+ quality 1)))) @@ -77,14 +77,14 @@ (if (< quality 50) (setf quality (+ quality 1))))))) - (if (not (equalp name "Sulfuras, Hand of Ragnaros")) + (if (not (equalp name "Fine Italian Silk")) (setf sell-in (- sell-in 1))) (if (< sell-in 0) - (if (not (equalp name "Aged Brie")) - (if (not (equalp name "Backstage passes to a TAFKAL80ETC concert")) + (if (not (equalp name "Aged Cheese")) + (if (not (equalp name "Backstage passes to a concert")) (if (> quality 0) - (if (not (equalp name "Sulfuras, Hand of Ragnaros")) + (if (not (equalp name "Fine Italian Silk")) (setf quality (- quality 1)))) (setf quality (- quality quality))) (if (< quality 50) @@ -106,16 +106,16 @@ (defun run-gilded-rose (days) (write-line "OMGHAI!") - (let* ((descriptions '(("+5 Dexterity Vest" 10 20) - ("Aged Brie" 2 0) - ("Elixir of the Mongoose" 5 7) - ("Sulfuras, Hand of Ragnaros" 0 80) - ("Sulfuras, Hand of Ragnaros" -1 80) - ("Backstage passes to a TAFKAL80ETC concert" 15 20) - ("Backstage passes to a TAFKAL80ETC concert" 10 49) - ("Backstage passes to a TAFKAL80ETC concert" 5 49) - ;; this conjured item does not work properly yet - ("Conjured Mana Cake" 3 6))) + (let* ((descriptions '(("Sports Memorabilia" 10 20) + ("Aged Cheese" 2 0) + ("Coffee Table Book" 5 7) + ("Fine Italian Silk" 0 80) + ("Fine Italian Silk" -1 80) + ("Backstage passes to a concert" 15 20) + ("Backstage passes to a concert" 10 49) + ("Backstage passes to a concert" 5 49) + ;; this Baked item does not work properly yet + ("Baked Chocolate Cake" 3 6))) (items (loop :for (name sell-in quality) :in descriptions :collect (make-item :name name :sell-in sell-in diff --git a/commonlisp/gilded-rose.lisp b/commonlisp/gilded-rose.lisp index e047ffb6..18691f0f 100644 --- a/commonlisp/gilded-rose.lisp +++ b/commonlisp/gilded-rose.lisp @@ -15,16 +15,16 @@ ;; Pretty simple, right? Well this is where it gets interesting: ;; Once the sell by date has passed, Quality degrades twice as fast ;; The Quality of an item is never negative -;; "Aged Brie" actually increases in Quality the older it gets +;; "Aged Cheese" actually increases in Quality the older it gets ;; The Quality of an item is never more than 50 -;; "Sulfuras", being a legendary item, never has to be sold or decreases in Quality -;; "Backstage passes", like aged brie, increases in Quality as it's +;; "Fine Italian Silk", being a luxury item, never has to be sold or decreases in Quality +;; "Backstage passes", like Aged Cheese, increases in Quality as it's ;; SellIn value approaches; Quality increases by 2 when there are 10 ;; days or less and by 3 when there are 5 days or less but Quality ;; drops to 0 after the concert -;; We have recently signed a supplier of conjured items. This requires an update to our system: -;; "Conjured" items degrade in Quality twice as fast as normal items +;; We have recently signed a supplier of Baked items. This requires an update to our system: +;; "Baked" items degrade in Quality twice as fast as normal items ;; Feel free to make any changes to the UpdateQuality method and add ;; any new code as long as everything still works correctly. However, ;; do not alter the Item class or Items property as those belong to the @@ -33,7 +33,7 @@ ;; UpdateQuality method and Items property static if you like, we'll ;; cover for you). ;; Just for clarification, an item can never have its Quality increase -;; above 50, however "Sulfuras" is a legendary item and as such its +;; above 50, however "Fine Italian Silk" is a luxury item and as such its ;; Quality is 80 and it never alters. ;; https://github.com/emilybache/GildedRose-Refactoring-Kata @@ -71,14 +71,14 @@ (dotimes (i (length items)) (with-slots (name quality sell-in) (elt items i) - (if (and (not (equalp name "Aged Brie")) - (not (equalp name "Backstage passes to a TAFKAL80ETC concert"))) + (if (and (not (equalp name "Aged Cheese")) + (not (equalp name "Backstage passes to a concert"))) (if (> quality 0) - (if (not (equalp name "Sulfuras, Hand of Ragnaros")) + (if (not (equalp name "Fine Italian Silk")) (setf quality (- quality 1)))) (when (< quality 50) (setf quality (+ quality 1)) - (when (equalp name "Backstage passes to a TAFKAL80ETC concert") + (when (equalp name "Backstage passes to a concert") (if (< sell-in 11) (if (< quality 50) (setf quality (+ quality 1)))) @@ -86,14 +86,14 @@ (if (< quality 50) (setf quality (+ quality 1))))))) - (if (not (equalp name "Sulfuras, Hand of Ragnaros")) + (if (not (equalp name "Fine Italian Silk")) (setf sell-in (- sell-in 1))) (if (< sell-in 0) - (if (not (equalp name "Aged Brie")) - (if (not (equalp name "Backstage passes to a TAFKAL80ETC concert")) + (if (not (equalp name "Aged Cheese")) + (if (not (equalp name "Backstage passes to a concert")) (if (> quality 0) - (if (not (equalp name "Sulfuras, Hand of Ragnaros")) + (if (not (equalp name "Fine Italian Silk")) (setf quality (- quality 1)))) (setf quality (- quality quality))) (if (< quality 50) @@ -103,16 +103,16 @@ (defun run-gilded-rose (days) (write-line "OMGHAI!") - (let* ((descriptions '(("+5 Dexterity Vest" 10 20) - ("Aged Brie" 2 0) - ("Elixir of the Mongoose" 5 7) - ("Sulfuras, Hand of Ragnaros" 0 80) - ("Sulfuras, Hand of Ragnaros" -1 80) - ("Backstage passes to a TAFKAL80ETC concert" 15 20) - ("Backstage passes to a TAFKAL80ETC concert" 10 49) - ("Backstage passes to a TAFKAL80ETC concert" 5 49) - ;; this conjured item does not work properly yet - ("Conjured Mana Cake" 3 6))) + (let* ((descriptions '(("Sports Memorabilia" 10 20) + ("Aged Cheese" 2 0) + ("Coffee Table Book" 5 7) + ("Fine Italian Silk" 0 80) + ("Fine Italian Silk" -1 80) + ("Backstage passes to a concert" 15 20) + ("Backstage passes to a concert" 10 49) + ("Backstage passes to a concert" 5 49) + ;; this Baked item does not work properly yet + ("Baked Chocolate Cake" 3 6))) (items (loop :for (name sell-in quality) :in descriptions :collect (make-instance 'item :name name diff --git a/cpp-catch2/src/GildedRose.cc b/cpp-catch2/src/GildedRose.cc index 8df23e47..a6815aa7 100644 --- a/cpp-catch2/src/GildedRose.cc +++ b/cpp-catch2/src/GildedRose.cc @@ -2,16 +2,16 @@ GildedRose::GildedRose(vector & items) : items(items) {} - -void GildedRose::updateQuality() + +void GildedRose::updateQuality() { for (int i = 0; i < items.size(); i++) { - if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name != "Aged Cheese" && items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } @@ -23,7 +23,7 @@ void GildedRose::updateQuality() { items[i].quality = items[i].quality + 1; - if (items[i].name == "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name == "Backstage passes to a concert") { if (items[i].sellIn < 11) { @@ -44,20 +44,20 @@ void GildedRose::updateQuality() } } - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].sellIn = items[i].sellIn - 1; } if (items[i].sellIn < 0) { - if (items[i].name != "Aged Brie") + if (items[i].name != "Aged Cheese") { - if (items[i].name != "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } diff --git a/cpp/src/GildedRose.cc b/cpp/src/GildedRose.cc index 8df23e47..a6815aa7 100644 --- a/cpp/src/GildedRose.cc +++ b/cpp/src/GildedRose.cc @@ -2,16 +2,16 @@ GildedRose::GildedRose(vector & items) : items(items) {} - -void GildedRose::updateQuality() + +void GildedRose::updateQuality() { for (int i = 0; i < items.size(); i++) { - if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name != "Aged Cheese" && items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } @@ -23,7 +23,7 @@ void GildedRose::updateQuality() { items[i].quality = items[i].quality + 1; - if (items[i].name == "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name == "Backstage passes to a concert") { if (items[i].sellIn < 11) { @@ -44,20 +44,20 @@ void GildedRose::updateQuality() } } - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].sellIn = items[i].sellIn - 1; } if (items[i].sellIn < 0) { - if (items[i].name != "Aged Brie") + if (items[i].name != "Aged Cheese") { - if (items[i].name != "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } diff --git a/cpp/test/cpp_texttest/GildedRoseTextTests.cc b/cpp/test/cpp_texttest/GildedRoseTextTests.cc index 548d1d6a..2dc19566 100644 --- a/cpp/test/cpp_texttest/GildedRoseTextTests.cc +++ b/cpp/test/cpp_texttest/GildedRoseTextTests.cc @@ -10,17 +10,17 @@ int main() { vector items; - items.push_back({"+5 Dexterity Vest", 10, 20}); - items.push_back({"Aged Brie", 2, 0}); - items.push_back({"Elixir of the Mongoose", 5, 7}); - items.push_back({"Sulfuras, Hand of Ragnaros", 0, 80}); - items.push_back({"Sulfuras, Hand of Ragnaros", -1, 80}); - items.push_back({"Backstage passes to a TAFKAL80ETC concert", 15, 20}); - items.push_back({"Backstage passes to a TAFKAL80ETC concert", 10, 49}); - items.push_back({"Backstage passes to a TAFKAL80ETC concert", 5, 49}); + items.push_back({"Sports Memorabilia", 10, 20}); + items.push_back({"Aged Cheese", 2, 0}); + items.push_back({"Coffee Table Book", 5, 7}); + items.push_back({"Fine Italian Silk", 0, 80}); + items.push_back({"Fine Italian Silk", -1, 80}); + items.push_back({"Backstage passes to a concert", 15, 20}); + items.push_back({"Backstage passes to a concert", 10, 49}); + items.push_back({"Backstage passes to a concert", 5, 49}); - // this Conjured item doesn't yet work properly - items.push_back({"Conjured Mana Cake", 3, 6}); + // this Baked item doesn't yet work properly + items.push_back({"Baked Chocolate Cake", 3, 6}); std::cout << "OMGHAI!" << std::endl; diff --git a/csharp/GildedRose.cs b/csharp/GildedRose.cs index c60d97a0..c7897ba2 100644 --- a/csharp/GildedRose.cs +++ b/csharp/GildedRose.cs @@ -14,11 +14,11 @@ namespace csharp { for (var i = 0; i < Items.Count; i++) { - if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name != "Aged Cheese" && Items[i].Name != "Backstage passes to a concert") { if (Items[i].Quality > 0) { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].Quality = Items[i].Quality - 1; } @@ -30,7 +30,7 @@ namespace csharp { Items[i].Quality = Items[i].Quality + 1; - if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name == "Backstage passes to a concert") { if (Items[i].SellIn < 11) { @@ -51,20 +51,20 @@ namespace csharp } } - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].SellIn = Items[i].SellIn - 1; } if (Items[i].SellIn < 0) { - if (Items[i].Name != "Aged Brie") + if (Items[i].Name != "Aged Cheese") { - if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name != "Backstage passes to a concert") { if (Items[i].Quality > 0) { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].Quality = Items[i].Quality - 1; } diff --git a/csharp/Program.cs b/csharp/Program.cs index 36313e27..388929fb 100644 --- a/csharp/Program.cs +++ b/csharp/Program.cs @@ -7,34 +7,34 @@ namespace csharp { public static void Main(string[] args) { - Console.WriteLine("OMGHAI!"); + Console.WriteLine("Calculating the inventory report..."); IList Items = new List{ - new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20}, - new Item {Name = "Aged Brie", SellIn = 2, Quality = 0}, - new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80}, + new Item {Name = "Sports Memorabilia", SellIn = 10, Quality = 20}, + new Item {Name = "Aged Cheese", SellIn = 2, Quality = 0}, + new Item {Name = "Coffee Table Book", SellIn = 5, Quality = 7}, + new Item {Name = "Fine Italian Silk", SellIn = 0, Quality = 80}, + new Item {Name = "Fine Italian Silk", SellIn = -1, Quality = 80}, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 15, Quality = 20 }, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 10, Quality = 49 }, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 5, Quality = 49 }, - // this conjured item does not work properly yet - new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6} + // this Baked item does not work properly yet + new Item {Name = "Baked Chocolate Cake", SellIn = 3, Quality = 6} }; var app = new GildedRose(Items); diff --git a/csharpcore-Verify.xunit/GildedRose/GildedRose.cs b/csharpcore-Verify.xunit/GildedRose/GildedRose.cs index ed7dc428..860f5cb6 100644 --- a/csharpcore-Verify.xunit/GildedRose/GildedRose.cs +++ b/csharpcore-Verify.xunit/GildedRose/GildedRose.cs @@ -14,11 +14,11 @@ namespace GildedRoseKata { for (var i = 0; i < Items.Count; i++) { - if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name != "Aged Cheese" && Items[i].Name != "Backstage passes to a concert") { if (Items[i].Quality > 0) { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].Quality = Items[i].Quality - 1; } @@ -30,7 +30,7 @@ namespace GildedRoseKata { Items[i].Quality = Items[i].Quality + 1; - if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name == "Backstage passes to a concert") { if (Items[i].SellIn < 11) { @@ -51,20 +51,20 @@ namespace GildedRoseKata } } - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].SellIn = Items[i].SellIn - 1; } if (Items[i].SellIn < 0) { - if (Items[i].Name != "Aged Brie") + if (Items[i].Name != "Aged Cheese") { - if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name != "Backstage passes to a concert") { if (Items[i].Quality > 0) { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].Quality = Items[i].Quality - 1; } diff --git a/csharpcore-Verify.xunit/GildedRose/Program.cs b/csharpcore-Verify.xunit/GildedRose/Program.cs index 1367fe73..03d98b94 100644 --- a/csharpcore-Verify.xunit/GildedRose/Program.cs +++ b/csharpcore-Verify.xunit/GildedRose/Program.cs @@ -10,31 +10,31 @@ namespace GildedRoseKata Console.WriteLine("OMGHAI!"); IList Items = new List{ - new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20}, - new Item {Name = "Aged Brie", SellIn = 2, Quality = 0}, - new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80}, + new Item {Name = "Sports Memorabilia", SellIn = 10, Quality = 20}, + new Item {Name = "Aged Cheese", SellIn = 2, Quality = 0}, + new Item {Name = "Coffee Table Book", SellIn = 5, Quality = 7}, + new Item {Name = "Fine Italian Silk", SellIn = 0, Quality = 80}, + new Item {Name = "Fine Italian Silk", SellIn = -1, Quality = 80}, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 15, Quality = 20 }, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 10, Quality = 49 }, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 5, Quality = 49 }, - // this conjured item does not work properly yet - new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6} + // this Baked item does not work properly yet + new Item {Name = "Baked Chocolate Cake", SellIn = 3, Quality = 6} }; var app = new GildedRose(Items); diff --git a/csharpcore/GildedRose/GildedRose.cs b/csharpcore/GildedRose/GildedRose.cs index ed7dc428..860f5cb6 100644 --- a/csharpcore/GildedRose/GildedRose.cs +++ b/csharpcore/GildedRose/GildedRose.cs @@ -14,11 +14,11 @@ namespace GildedRoseKata { for (var i = 0; i < Items.Count; i++) { - if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name != "Aged Cheese" && Items[i].Name != "Backstage passes to a concert") { if (Items[i].Quality > 0) { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].Quality = Items[i].Quality - 1; } @@ -30,7 +30,7 @@ namespace GildedRoseKata { Items[i].Quality = Items[i].Quality + 1; - if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name == "Backstage passes to a concert") { if (Items[i].SellIn < 11) { @@ -51,20 +51,20 @@ namespace GildedRoseKata } } - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].SellIn = Items[i].SellIn - 1; } if (Items[i].SellIn < 0) { - if (Items[i].Name != "Aged Brie") + if (Items[i].Name != "Aged Cheese") { - if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") + if (Items[i].Name != "Backstage passes to a concert") { if (Items[i].Quality > 0) { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") + if (Items[i].Name != "Fine Italian Silk") { Items[i].Quality = Items[i].Quality - 1; } diff --git a/csharpcore/GildedRoseTests/TexttestFixture.cs b/csharpcore/GildedRoseTests/TexttestFixture.cs index e95c4e08..45f5aeaa 100644 --- a/csharpcore/GildedRoseTests/TexttestFixture.cs +++ b/csharpcore/GildedRoseTests/TexttestFixture.cs @@ -13,31 +13,31 @@ namespace GildedRoseTests Console.WriteLine("OMGHAI!"); IList Items = new List{ - new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20}, - new Item {Name = "Aged Brie", SellIn = 2, Quality = 0}, - new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80}, + new Item {Name = "Sports Memorabilia", SellIn = 10, Quality = 20}, + new Item {Name = "Aged Cheese", SellIn = 2, Quality = 0}, + new Item {Name = "Coffee Table Book", SellIn = 5, Quality = 7}, + new Item {Name = "Fine Italian Silk", SellIn = 0, Quality = 80}, + new Item {Name = "Fine Italian Silk", SellIn = -1, Quality = 80}, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 15, Quality = 20 }, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 10, Quality = 49 }, new Item { - Name = "Backstage passes to a TAFKAL80ETC concert", + Name = "Backstage passes to a concert", SellIn = 5, Quality = 49 }, - // this conjured item does not work properly yet - new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6} + // this Baked item does not work properly yet + new Item {Name = "Baked Chocolate Cake", SellIn = 3, Quality = 6} }; var app = new GildedRose(Items); diff --git a/d/src/GildedRose.d b/d/src/GildedRose.d index 1b0a8795..9039a872 100644 --- a/d/src/GildedRose.d +++ b/d/src/GildedRose.d @@ -18,12 +18,12 @@ public: { for (int i = 0; i < items.length; i++) { - if (items[i].name != "Aged Brie" - && items[i].name != "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name != "Aged Cheese" + && items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } @@ -35,7 +35,7 @@ public: { items[i].quality = items[i].quality + 1; - if (items[i].name == "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name == "Backstage passes to a concert") { if (items[i].sellIn < 11) { @@ -56,20 +56,20 @@ public: } } - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].sellIn = items[i].sellIn - 1; } if (items[i].sellIn < 0) { - if (items[i].name != "Aged Brie") + if (items[i].name != "Aged Cheese") { - if (items[i].name != "Backstage passes to a TAFKAL80ETC concert") + if (items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } diff --git a/d/src/GildedRoseTextTests.d b/d/src/GildedRoseTextTests.d index 3dc6887f..7f9e87c3 100644 --- a/d/src/GildedRoseTextTests.d +++ b/d/src/GildedRoseTextTests.d @@ -5,16 +5,16 @@ int main() import std.stdio : writefln, writeln; Item[] items = [ - Item("+5 Dexterity Vest", 10, 20), - Item("Aged Brie", 2, 0), - Item("Elixir of the Mongoose", 5, 7), - Item("Sulfuras, Hand of Ragnaros", 0, 80), - Item("Sulfuras, Hand of Ragnaros", -1, 80), - Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this Conjured item doesn't yet work properly - Item("Conjured Mana Cake", 3, 6), + Item("Sports Memorabilia", 10, 20), + Item("Aged Cheese", 2, 0), + Item("Coffee Table Book", 5, 7), + Item("Fine Italian Silk", 0, 80), + Item("Fine Italian Silk", -1, 80), + Item("Backstage passes to a concert", 15, 20), + Item("Backstage passes to a concert", 10, 49), + Item("Backstage passes to a concert", 5, 49), + // this Baked item doesn't yet work properly + Item("Baked Chocolate Cake", 3, 6), ]; auto app = new GildedRose(items); diff --git a/d/test/GildedRoseUnitTests.d b/d/test/GildedRoseUnitTests.d index ac58c703..4ab06965 100644 --- a/d/test/GildedRoseUnitTests.d +++ b/d/test/GildedRoseUnitTests.d @@ -13,12 +13,12 @@ unittest void example() { Item[] items = [ - Item("+5 Dexterity Vest", 10, 20), - Item("Aged Brie", 2, 0), - Item("Elixir of the Mongoose", 5, 7), - Item("Sulfuras, Hand of Ragnaros", 0, 80), - Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - Item("Conjured Mana Cake", 3, 6), + Item("Sports Memorabilia", 10, 20), + Item("Aged Cheese", 2, 0), + Item("Coffee Table Book", 5, 7), + Item("Fine Italian Silk", 0, 80), + Item("Backstage passes to a concert", 15, 20), + Item("Baked Chocolate Cake", 3, 6), ]; auto app = new GildedRose(items); app.updateQuality; diff --git a/dart/bin/main.dart b/dart/bin/main.dart index 240994c5..c4059d58 100644 --- a/dart/bin/main.dart +++ b/dart/bin/main.dart @@ -4,16 +4,16 @@ main(List args) { print("OMGHAI!"); var items = [ - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6) + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6) ]; GildedRose app = new GildedRose(items); diff --git a/dart/lib/gilded_rose.dart b/dart/lib/gilded_rose.dart index 94857b32..2ff6ef1f 100644 --- a/dart/lib/gilded_rose.dart +++ b/dart/lib/gilded_rose.dart @@ -5,10 +5,10 @@ class GildedRose { void updateQuality() { for (int i = 0; i < items.length; i++) { - if (items[i].name != "Aged Brie" && - items[i].name != "Backstage passes to a TAFKAL80ETC concert") { + if (items[i].name != "Aged Cheese" && + items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") { + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } } @@ -16,7 +16,7 @@ class GildedRose { 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].name == "Backstage passes to a concert") { if (items[i].sellIn < 11) { if (items[i].quality < 50) { items[i].quality = items[i].quality + 1; @@ -32,15 +32,15 @@ class GildedRose { } } - if (items[i].name != "Sulfuras, Hand of Ragnaros") { + if (items[i].name != "Fine Italian Silk") { 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].name != "Aged Cheese") { + if (items[i].name != "Backstage passes to a concert") { if (items[i].quality > 0) { - if (items[i].name != "Sulfuras, Hand of Ragnaros") { + if (items[i].name != "Fine Italian Silk") { items[i].quality = items[i].quality - 1; } } diff --git a/elixir/lib/gilded_rose.ex b/elixir/lib/gilded_rose.ex index 7edd8c83..48b3d10c 100644 --- a/elixir/lib/gilded_rose.ex +++ b/elixir/lib/gilded_rose.ex @@ -1,7 +1,7 @@ defmodule GildedRose do # Example - # update_quality([%Item{name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 9, quality: 1}]) - # => [%Item{name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 8, quality: 3}] + # update_quality([%Item{name: "Backstage passes to a concert", sell_in: 9, quality: 1}]) + # => [%Item{name: "Backstage passes to a concert", sell_in: 8, quality: 3}] def update_quality(items) do Enum.map(items, &update_item/1) @@ -9,9 +9,9 @@ defmodule GildedRose do def update_item(item) do item = cond do - item.name != "Aged Brie" && item.name != "Backstage passes to a TAFKAL80ETC concert" -> + item.name != "Aged Cheese" && item.name != "Backstage passes to a concert" -> if item.quality > 0 do - if item.name != "Sulfuras, Hand of Ragnaros" do + if item.name != "Fine Italian Silk" do %{item | quality: item.quality - 1} else item @@ -24,7 +24,7 @@ defmodule GildedRose do item.quality < 50 -> item = %{item | quality: item.quality + 1} cond do - item.name == "Backstage passes to a TAFKAL80ETC concert" -> + item.name == "Backstage passes to a concert" -> item = cond do item.sell_in < 11 -> cond do @@ -49,20 +49,20 @@ defmodule GildedRose do end end item = cond do - item.name != "Sulfuras, Hand of Ragnaros" -> + item.name != "Fine Italian Silk" -> %{item | sell_in: item.sell_in - 1} true -> item end cond do item.sell_in < 0 -> cond do - item.name != "Aged Brie" -> + item.name != "Aged Cheese" -> cond do - item.name != "Backstage passes to a TAFKAL80ETC concert" -> + item.name != "Backstage passes to a concert" -> cond do item.quality > 0 -> cond do - item.name != "Sulfuras, Hand of Ragnaros" -> + item.name != "Fine Italian Silk" -> %{item | quality: item.quality - 1} true -> item end diff --git a/elm/src/GildedRose.elm b/elm/src/GildedRose.elm index bf97c94a..732c1e89 100644 --- a/elm/src/GildedRose.elm +++ b/elm/src/GildedRose.elm @@ -12,9 +12,9 @@ update_quality : List Item -> List Item update_quality items = List.map (\item -> - if item.name == "Aged Brie" || item.name == "Backstage passes to a TAFKAL80ETC concert" then + if item.name == "Aged Cheese" || item.name == "Backstage passes to a concert" then if item.quality < 50 then - if item.name == "Backstage passes to a TAFKAL80ETC concert" then + if item.name == "Backstage passes to a concert" then if item.sell_by < 0 then { item | sell_by = item.sell_by - 1, quality = 0 } @@ -33,7 +33,7 @@ update_quality items = else { item | sell_by = item.sell_by } - else if item.name /= "Aged Brie" && item.name /= "Sulfuras, Hand of Ragnaros" then + else if item.name /= "Aged Cheese" && item.name /= "Fine Italian Silk" then if item.sell_by < 0 && item.quality > 0 then if item.quality >= 2 then { item | sell_by = item.sell_by - 1, quality = item.quality - 2 } diff --git a/erlang/src/gilded_rose.erl b/erlang/src/gilded_rose.erl index 68f7efac..b78b1363 100644 --- a/erlang/src/gilded_rose.erl +++ b/erlang/src/gilded_rose.erl @@ -13,11 +13,11 @@ update_quality(Items) -> -spec update_item(#item{}) -> #item{}. update_item(Item = #item{name = Name}) -> Item1 = if - Name /= "Aged Brie" andalso Name /= "Backstage passes to a TAFKAL80ETC concert" -> + Name /= "Aged Cheese" andalso Name /= "Backstage passes to a concert" -> if Item#item.quality > 0 -> if - Name /= "Sulfuras, Hand of Ragnaros" -> + Name /= "Fine Italian Silk" -> Item#item{quality = Item#item.quality - 1}; true -> Item @@ -30,7 +30,7 @@ update_item(Item = #item{name = Name}) -> Item#item.quality < 50 -> Item2 = Item#item{quality = Item#item.quality + 1}, if - Name == "Backstage passes to a TAFKAL80ETC concert" -> + Name == "Backstage passes to a concert" -> Item3 = if Item2#item.sell_in < 11 -> if @@ -55,20 +55,20 @@ update_item(Item = #item{name = Name}) -> end end, Item4 = if - Name /= "Sulfuras, Hand of Ragnaros" -> + Name /= "Fine Italian Silk" -> Item1#item{sell_in = Item1#item.sell_in - 1}; true -> Item1 end, if Item4#item.sell_in < 0 -> if - Name /= "Aged Brie" -> + Name /= "Aged Cheese" -> if - Name /= "Backstage passes to a TAFKAL80ETC concert" -> + Name /= "Backstage passes to a concert" -> if Item4#item.quality > 0 -> if - Name /= "Sulfuras, Hand of Ragnaros" -> + Name /= "Fine Italian Silk" -> Item4#item{quality = Item4#item.quality - 1}; true -> Item4 end; diff --git a/erlang/src/main.erl b/erlang/src/main.erl index 17f76489..8a5a7563 100644 --- a/erlang/src/main.erl +++ b/erlang/src/main.erl @@ -5,15 +5,15 @@ -export([main/1]). -define(ALL_ITEMS, [ - #item{name = "+5 Dexterity Vest", sell_in = 10, quality = 20}, - #item{name = "Aged Brie", sell_in = 2, quality = 0}, - #item{name = "Elixir of the Mongoose", sell_in = 5, quality = 7}, - #item{name = "Sulfuras, Hand of Ragnaros", sell_in = 0, quality = 80}, - #item{name = "Sulfuras, Hand of Ragnaros", sell_in = -1, quality = 80}, - #item{name = "Backstage passes to a TAFKAL80ETC concert", sell_in = 15, quality = 20}, - #item{name = "Backstage passes to a TAFKAL80ETC concert", sell_in = 10, quality = 49}, - #item{name = "Backstage passes to a TAFKAL80ETC concert", sell_in = 5, quality = 49}, - #item{name = "Conjured Mana Cake", sell_in = 3, quality = 6} + #item{name = "Sports Memorabilia", sell_in = 10, quality = 20}, + #item{name = "Aged Cheese", sell_in = 2, quality = 0}, + #item{name = "Coffee Table Book", sell_in = 5, quality = 7}, + #item{name = "Fine Italian Silk", sell_in = 0, quality = 80}, + #item{name = "Fine Italian Silk", sell_in = -1, quality = 80}, + #item{name = "Backstage passes to a concert", sell_in = 15, quality = 20}, + #item{name = "Backstage passes to a concert", sell_in = 10, quality = 49}, + #item{name = "Backstage passes to a concert", sell_in = 5, quality = 49}, + #item{name = "Baked Chocolate Cake", sell_in = 3, quality = 6} ]). main([Days]) -> diff --git a/fortran/src/GildedRose.f90 b/fortran/src/GildedRose.f90 index 68e9c896..818e74e0 100644 --- a/fortran/src/GildedRose.f90 +++ b/fortran/src/GildedRose.f90 @@ -20,43 +20,43 @@ contains subroutine init_item(it, name, sellIn, quality) type(Item) :: it - character(len=*) :: name - integer :: sellIn - integer :: quality + character(len=*) :: name + integer :: sellIn + integer :: quality it%name = trim(name) it%sellIn = sellIn it%quality = quality - end + end function int2str( int_val ) implicit none integer :: int_val character( int(log10(real(max(abs(int_val),1)))) + 1 + & (1-sign(1,int_val))/2 ) :: int2str - character(64) :: all_chars + character(64) :: all_chars write(all_chars,*) int_val int2str = trim( adjustl( all_chars ) ) end function - + subroutine print_item(it) - type(Item) :: it + type(Item) :: it write(*,*) trim(it%name), ', ', int2str(it%sellIn), ', ', int2str(it%quality) - end subroutine - + end subroutine + subroutine update_quality(items, size) type(Item), dimension(:) :: items - integer :: size + integer :: size - integer :: i + integer :: i do i = 1, size - if (items(i)%name /= "Aged Brie" .and. items(i)%name /= "Backstage passes to a TAFKAL80ETC concert" ) then + if (items(i)%name /= "Aged Cheese" .and. items(i)%name /= "Backstage passes to a concert" ) then if (items(i)%quality > 0) then - if (items(i)%name /= "Sulfuras, Hand of Ragnaros" ) then + if (items(i)%name /= "Fine Italian Silk" ) then items(i)%quality = items(i)%quality - 1 endif @@ -68,8 +68,8 @@ contains if (items(i)%quality < 50) then items(i)%quality = items(i)%quality + 1 - - if ( items(i)%name =="Backstage passes to a TAFKAL80ETC concert") then + + if ( items(i)%name =="Backstage passes to a concert") then if (items(i)%sellIn < 11) then @@ -96,28 +96,28 @@ contains endif endif - if (items(i)%name /= "Sulfuras, Hand of Ragnaros") then + if (items(i)%name /= "Fine Italian Silk") then items(i)%sellIn = items(i)%sellIn - 1 endif - + if (items(i)%sellIn < 0) then - if (items(i)%name /= "Aged Brie" ) then + if (items(i)%name /= "Aged Cheese" ) then - if (items(i)%name /= "Backstage passes to a TAFKAL80ETC concert" ) then + if (items(i)%name /= "Backstage passes to a concert" ) then if (items(i)%quality > 0 ) then - if (items(i)%name /= "Sulfuras, Hand of Ragnaros" )then + if (items(i)%name /= "Fine Italian Silk" )then items(i)%quality = items(i)%quality - 1 endif endif - + else items(i)%quality = items(i)%quality - items(i)%quality @@ -137,8 +137,8 @@ contains end if end do - + end subroutine - + end module diff --git a/fortran/test/GildedRose_text_test.f90 b/fortran/test/GildedRose_text_test.f90 index c285970d..6ed3fe8f 100644 --- a/fortran/test/GildedRose_text_test.f90 +++ b/fortran/test/GildedRose_text_test.f90 @@ -14,24 +14,24 @@ program GildedRose_text_test last = 1 - call init_item(items(last), "+5 Dexterity Vest", 10, 20) + call init_item(items(last), "Sports Memorabilia", 10, 20) last=last+1 - call init_item(items(last), "Aged Brie", 2, 0) + call init_item(items(last), "Aged Cheese", 2, 0) last=last+1 - call init_item(items(last), "Elixir of the Mongoose", 5, 7) + call init_item(items(last), "Coffee Table Book", 5, 7) last=last+1 - call init_item(items(last), "Sulfuras, Hand of Ragnaros", 0, 80) + call init_item(items(last), "Fine Italian Silk", 0, 80) last=last+1 - call init_item(items(last), "Sulfuras, Hand of Ragnaros", -1, 80) + call init_item(items(last), "Fine Italian Silk", -1, 80) last=last+1 - call init_item(items(last), "Backstage passes to a TAFKAL80ETC concert", 15, 20) + call init_item(items(last), "Backstage passes to a concert", 15, 20) last=last+1 - call init_item(items(last), "Backstage passes to a TAFKAL80ETC concert", 10, 49) + call init_item(items(last), "Backstage passes to a concert", 10, 49) last=last+1 - call init_item(items(last), "Backstage passes to a TAFKAL80ETC concert", 5, 49) - ! this Conjured item doesn't yet work properly + call init_item(items(last), "Backstage passes to a concert", 5, 49) + ! this Baked item doesn't yet work properly last=last+1 - call init_item(items(last), "Conjured Mana Cake", 3, 6) + call init_item(items(last), "Baked Chocolate Cake", 3, 6) write(*,*) "OMGHAI!" @@ -46,7 +46,7 @@ program GildedRose_text_test write(*,*) " " call update_quality(items, last) - enddo + enddo end program diff --git a/fsharp-core/GildedRose.ApprovalTests/GildedRoseTest.ApprovalTest.ThirtyDays.received.txt b/fsharp-core/GildedRose.ApprovalTests/GildedRoseTest.ApprovalTest.ThirtyDays.received.txt index cd66984f..7225a137 100644 --- a/fsharp-core/GildedRose.ApprovalTests/GildedRoseTest.ApprovalTest.ThirtyDays.received.txt +++ b/fsharp-core/GildedRose.ApprovalTests/GildedRoseTest.ApprovalTest.ThirtyDays.received.txt @@ -1,373 +1,373 @@ OMGHAI! -------- day 0 -------- name, sellIn, quality -+5 Dexterity Vest, 10, 20 -Aged Brie, 2, 0 -Elixir of the Mongoose, 5, 7 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 15, 20 -Backstage passes to a TAFKAL80ETC concert, 10, 49 -Backstage passes to a TAFKAL80ETC concert, 5, 49 -Conjured Mana Cake, 3, 6 +Sports Memorabilia, 10, 20 +Aged Cheese, 2, 0 +Coffee Table Book, 5, 7 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 15, 20 +Backstage passes to a concert, 10, 49 +Backstage passes to a concert, 5, 49 +Baked Chocolate Cake, 3, 6 -------- day 1 -------- name, sellIn, quality -+5 Dexterity Vest, 9, 19 -Aged Brie, 1, 1 -Elixir of the Mongoose, 4, 6 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 14, 21 -Backstage passes to a TAFKAL80ETC concert, 9, 50 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Conjured Mana Cake, 2, 5 +Sports Memorabilia, 9, 19 +Aged Cheese, 1, 1 +Coffee Table Book, 4, 6 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 14, 21 +Backstage passes to a concert, 9, 50 +Backstage passes to a concert, 4, 50 +Baked Chocolate Cake, 2, 5 -------- day 2 -------- name, sellIn, quality -+5 Dexterity Vest, 8, 18 -Aged Brie, 0, 2 -Elixir of the Mongoose, 3, 5 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 13, 22 -Backstage passes to a TAFKAL80ETC concert, 8, 50 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Conjured Mana Cake, 1, 4 +Sports Memorabilia, 8, 18 +Aged Cheese, 0, 2 +Coffee Table Book, 3, 5 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 13, 22 +Backstage passes to a concert, 8, 50 +Backstage passes to a concert, 3, 50 +Baked Chocolate Cake, 1, 4 -------- day 3 -------- name, sellIn, quality -+5 Dexterity Vest, 7, 17 -Aged Brie, -1, 4 -Elixir of the Mongoose, 2, 4 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 12, 23 -Backstage passes to a TAFKAL80ETC concert, 7, 50 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Conjured Mana Cake, 0, 3 +Sports Memorabilia, 7, 17 +Aged Cheese, -1, 4 +Coffee Table Book, 2, 4 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 12, 23 +Backstage passes to a concert, 7, 50 +Backstage passes to a concert, 2, 50 +Baked Chocolate Cake, 0, 3 -------- day 4 -------- name, sellIn, quality -+5 Dexterity Vest, 6, 16 -Aged Brie, -2, 6 -Elixir of the Mongoose, 1, 3 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 11, 24 -Backstage passes to a TAFKAL80ETC concert, 6, 50 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Conjured Mana Cake, -1, 1 +Sports Memorabilia, 6, 16 +Aged Cheese, -2, 6 +Coffee Table Book, 1, 3 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 11, 24 +Backstage passes to a concert, 6, 50 +Backstage passes to a concert, 1, 50 +Baked Chocolate Cake, -1, 1 -------- day 5 -------- name, sellIn, quality -+5 Dexterity Vest, 5, 15 -Aged Brie, -3, 8 -Elixir of the Mongoose, 0, 2 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 10, 25 -Backstage passes to a TAFKAL80ETC concert, 5, 50 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Conjured Mana Cake, -2, 0 +Sports Memorabilia, 5, 15 +Aged Cheese, -3, 8 +Coffee Table Book, 0, 2 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 10, 25 +Backstage passes to a concert, 5, 50 +Backstage passes to a concert, 0, 50 +Baked Chocolate Cake, -2, 0 -------- day 6 -------- name, sellIn, quality -+5 Dexterity Vest, 4, 14 -Aged Brie, -4, 10 -Elixir of the Mongoose, -1, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 9, 27 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Conjured Mana Cake, -3, 0 +Sports Memorabilia, 4, 14 +Aged Cheese, -4, 10 +Coffee Table Book, -1, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 9, 27 +Backstage passes to a concert, 4, 50 +Backstage passes to a concert, -1, 0 +Baked Chocolate Cake, -3, 0 -------- day 7 -------- name, sellIn, quality -+5 Dexterity Vest, 3, 13 -Aged Brie, -5, 12 -Elixir of the Mongoose, -2, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 8, 29 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Conjured Mana Cake, -4, 0 +Sports Memorabilia, 3, 13 +Aged Cheese, -5, 12 +Coffee Table Book, -2, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 8, 29 +Backstage passes to a concert, 3, 50 +Backstage passes to a concert, -2, 0 +Baked Chocolate Cake, -4, 0 -------- day 8 -------- name, sellIn, quality -+5 Dexterity Vest, 2, 12 -Aged Brie, -6, 14 -Elixir of the Mongoose, -3, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 7, 31 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Conjured Mana Cake, -5, 0 +Sports Memorabilia, 2, 12 +Aged Cheese, -6, 14 +Coffee Table Book, -3, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 7, 31 +Backstage passes to a concert, 2, 50 +Backstage passes to a concert, -3, 0 +Baked Chocolate Cake, -5, 0 -------- day 9 -------- name, sellIn, quality -+5 Dexterity Vest, 1, 11 -Aged Brie, -7, 16 -Elixir of the Mongoose, -4, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 6, 33 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Conjured Mana Cake, -6, 0 +Sports Memorabilia, 1, 11 +Aged Cheese, -7, 16 +Coffee Table Book, -4, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 6, 33 +Backstage passes to a concert, 1, 50 +Backstage passes to a concert, -4, 0 +Baked Chocolate Cake, -6, 0 -------- day 10 -------- name, sellIn, quality -+5 Dexterity Vest, 0, 10 -Aged Brie, -8, 18 -Elixir of the Mongoose, -5, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 5, 35 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Conjured Mana Cake, -7, 0 +Sports Memorabilia, 0, 10 +Aged Cheese, -8, 18 +Coffee Table Book, -5, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 5, 35 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Baked Chocolate Cake, -7, 0 -------- day 11 -------- name, sellIn, quality -+5 Dexterity Vest, -1, 8 -Aged Brie, -9, 20 -Elixir of the Mongoose, -6, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 4, 38 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Conjured Mana Cake, -8, 0 +Sports Memorabilia, -1, 8 +Aged Cheese, -9, 20 +Coffee Table Book, -6, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 4, 38 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Baked Chocolate Cake, -8, 0 -------- day 12 -------- name, sellIn, quality -+5 Dexterity Vest, -2, 6 -Aged Brie, -10, 22 -Elixir of the Mongoose, -7, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 3, 41 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Conjured Mana Cake, -9, 0 +Sports Memorabilia, -2, 6 +Aged Cheese, -10, 22 +Coffee Table Book, -7, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 3, 41 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Baked Chocolate Cake, -9, 0 -------- day 13 -------- name, sellIn, quality -+5 Dexterity Vest, -3, 4 -Aged Brie, -11, 24 -Elixir of the Mongoose, -8, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 2, 44 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Conjured Mana Cake, -10, 0 +Sports Memorabilia, -3, 4 +Aged Cheese, -11, 24 +Coffee Table Book, -8, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 2, 44 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Baked Chocolate Cake, -10, 0 -------- day 14 -------- name, sellIn, quality -+5 Dexterity Vest, -4, 2 -Aged Brie, -12, 26 -Elixir of the Mongoose, -9, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 1, 47 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Conjured Mana Cake, -11, 0 +Sports Memorabilia, -4, 2 +Aged Cheese, -12, 26 +Coffee Table Book, -9, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 1, 47 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Baked Chocolate Cake, -11, 0 -------- day 15 -------- name, sellIn, quality -+5 Dexterity Vest, -5, 0 -Aged Brie, -13, 28 -Elixir of the Mongoose, -10, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Conjured Mana Cake, -12, 0 +Sports Memorabilia, -5, 0 +Aged Cheese, -13, 28 +Coffee Table Book, -10, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Baked Chocolate Cake, -12, 0 -------- day 16 -------- name, sellIn, quality -+5 Dexterity Vest, -6, 0 -Aged Brie, -14, 30 -Elixir of the Mongoose, -11, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Conjured Mana Cake, -13, 0 +Sports Memorabilia, -6, 0 +Aged Cheese, -14, 30 +Coffee Table Book, -11, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Baked Chocolate Cake, -13, 0 -------- day 17 -------- name, sellIn, quality -+5 Dexterity Vest, -7, 0 -Aged Brie, -15, 32 -Elixir of the Mongoose, -12, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Conjured Mana Cake, -14, 0 +Sports Memorabilia, -7, 0 +Aged Cheese, -15, 32 +Coffee Table Book, -12, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Baked Chocolate Cake, -14, 0 -------- day 18 -------- name, sellIn, quality -+5 Dexterity Vest, -8, 0 -Aged Brie, -16, 34 -Elixir of the Mongoose, -13, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Conjured Mana Cake, -15, 0 +Sports Memorabilia, -8, 0 +Aged Cheese, -16, 34 +Coffee Table Book, -13, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Baked Chocolate Cake, -15, 0 -------- day 19 -------- name, sellIn, quality -+5 Dexterity Vest, -9, 0 -Aged Brie, -17, 36 -Elixir of the Mongoose, -14, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Conjured Mana Cake, -16, 0 +Sports Memorabilia, -9, 0 +Aged Cheese, -17, 36 +Coffee Table Book, -14, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Baked Chocolate Cake, -16, 0 -------- day 20 -------- name, sellIn, quality -+5 Dexterity Vest, -10, 0 -Aged Brie, -18, 38 -Elixir of the Mongoose, -15, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Conjured Mana Cake, -17, 0 +Sports Memorabilia, -10, 0 +Aged Cheese, -18, 38 +Coffee Table Book, -15, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Baked Chocolate Cake, -17, 0 -------- day 21 -------- name, sellIn, quality -+5 Dexterity Vest, -11, 0 -Aged Brie, -19, 40 -Elixir of the Mongoose, -16, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Conjured Mana Cake, -18, 0 +Sports Memorabilia, -11, 0 +Aged Cheese, -19, 40 +Coffee Table Book, -16, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Baked Chocolate Cake, -18, 0 -------- day 22 -------- name, sellIn, quality -+5 Dexterity Vest, -12, 0 -Aged Brie, -20, 42 -Elixir of the Mongoose, -17, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Conjured Mana Cake, -19, 0 +Sports Memorabilia, -12, 0 +Aged Cheese, -20, 42 +Coffee Table Book, -17, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Baked Chocolate Cake, -19, 0 -------- day 23 -------- name, sellIn, quality -+5 Dexterity Vest, -13, 0 -Aged Brie, -21, 44 -Elixir of the Mongoose, -18, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Conjured Mana Cake, -20, 0 +Sports Memorabilia, -13, 0 +Aged Cheese, -21, 44 +Coffee Table Book, -18, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Baked Chocolate Cake, -20, 0 -------- day 24 -------- name, sellIn, quality -+5 Dexterity Vest, -14, 0 -Aged Brie, -22, 46 -Elixir of the Mongoose, -19, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Conjured Mana Cake, -21, 0 +Sports Memorabilia, -14, 0 +Aged Cheese, -22, 46 +Coffee Table Book, -19, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Baked Chocolate Cake, -21, 0 -------- day 25 -------- name, sellIn, quality -+5 Dexterity Vest, -15, 0 -Aged Brie, -23, 48 -Elixir of the Mongoose, -20, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Conjured Mana Cake, -22, 0 +Sports Memorabilia, -15, 0 +Aged Cheese, -23, 48 +Coffee Table Book, -20, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Baked Chocolate Cake, -22, 0 -------- day 26 -------- name, sellIn, quality -+5 Dexterity Vest, -16, 0 -Aged Brie, -24, 50 -Elixir of the Mongoose, -21, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Backstage passes to a TAFKAL80ETC concert, -21, 0 -Conjured Mana Cake, -23, 0 +Sports Memorabilia, -16, 0 +Aged Cheese, -24, 50 +Coffee Table Book, -21, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Backstage passes to a concert, -21, 0 +Baked Chocolate Cake, -23, 0 -------- day 27 -------- name, sellIn, quality -+5 Dexterity Vest, -17, 0 -Aged Brie, -25, 50 -Elixir of the Mongoose, -22, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Backstage passes to a TAFKAL80ETC concert, -22, 0 -Conjured Mana Cake, -24, 0 +Sports Memorabilia, -17, 0 +Aged Cheese, -25, 50 +Coffee Table Book, -22, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Backstage passes to a concert, -22, 0 +Baked Chocolate Cake, -24, 0 -------- day 28 -------- name, sellIn, quality -+5 Dexterity Vest, -18, 0 -Aged Brie, -26, 50 -Elixir of the Mongoose, -23, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Backstage passes to a TAFKAL80ETC concert, -23, 0 -Conjured Mana Cake, -25, 0 +Sports Memorabilia, -18, 0 +Aged Cheese, -26, 50 +Coffee Table Book, -23, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Backstage passes to a concert, -23, 0 +Baked Chocolate Cake, -25, 0 -------- day 29 -------- name, sellIn, quality -+5 Dexterity Vest, -19, 0 -Aged Brie, -27, 50 -Elixir of the Mongoose, -24, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Backstage passes to a TAFKAL80ETC concert, -24, 0 -Conjured Mana Cake, -26, 0 +Sports Memorabilia, -19, 0 +Aged Cheese, -27, 50 +Coffee Table Book, -24, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Backstage passes to a concert, -24, 0 +Baked Chocolate Cake, -26, 0 -------- day 30 -------- name, sellIn, quality -+5 Dexterity Vest, -20, 0 -Aged Brie, -28, 50 -Elixir of the Mongoose, -25, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Backstage passes to a TAFKAL80ETC concert, -25, 0 -Conjured Mana Cake, -27, 0 +Sports Memorabilia, -20, 0 +Aged Cheese, -28, 50 +Coffee Table Book, -25, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Backstage passes to a concert, -25, 0 +Baked Chocolate Cake, -27, 0 diff --git a/fsharp-core/GildedRose/Program.fs b/fsharp-core/GildedRose/Program.fs index a5adc97e..d0ba0517 100644 --- a/fsharp-core/GildedRose/Program.fs +++ b/fsharp-core/GildedRose/Program.fs @@ -9,33 +9,33 @@ type GildedRose(items:IList) = member this.UpdateQuality() = for i = 0 to Items.Count - 1 do - if Items.[i].Name <> "Aged Brie" && Items.[i].Name <> "Backstage passes to a TAFKAL80ETC concert" then + if Items.[i].Name <> "Aged Cheese" && Items.[i].Name <> "Backstage passes to a concert" then if Items.[i].Quality > 0 then - if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } + if Items.[i].Name <> "Fine Italian Silk" then + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } else if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } - if Items.[i].Name = "Backstage passes to a TAFKAL80ETC concert" then + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + if Items.[i].Name = "Backstage passes to a concert" then if Items.[i].SellIn < 11 then if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } if Items.[i].SellIn < 6 then if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } - if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then - Items.[i] <- { Items.[i] with SellIn = (Items.[i].SellIn - 1) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + if Items.[i].Name <> "Fine Italian Silk" then + Items.[i] <- { Items.[i] with SellIn = (Items.[i].SellIn - 1) } if Items.[i].SellIn < 0 then - if Items.[i].Name <> "Aged Brie" then - if Items.[i].Name <> "Backstage passes to a TAFKAL80ETC concert" then + if Items.[i].Name <> "Aged Cheese" then + if Items.[i].Name <> "Backstage passes to a concert" then if Items.[i].Quality > 0 then - if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } + if Items.[i].Name <> "Fine Italian Silk" then + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } else - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - Items.[i].Quality) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - Items.[i].Quality) } else if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } () @@ -44,15 +44,15 @@ module Program = let main argv = printfn "OMGHAI!" let Items = new List() - Items.Add({Name = "+5 Dexterity Vest"; SellIn = 10; Quality = 20}) - Items.Add({Name = "Aged Brie"; SellIn = 2; Quality = 0}) - Items.Add({Name = "Elixir of the Mongoose"; SellIn = 5; Quality = 7}) - Items.Add({Name = "Sulfuras, Hand of Ragnaros"; SellIn = 0; Quality = 80}) - Items.Add({Name = "Sulfuras, Hand of Ragnaros"; SellIn = -1; Quality = 80}) - Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 15; Quality = 20}) - Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 10; Quality = 49}) - Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 5; Quality = 49}) - Items.Add({Name = "Conjured Mana Cake"; SellIn = 3; Quality = 6}) + Items.Add({Name = "Sports Memorabilia"; SellIn = 10; Quality = 20}) + Items.Add({Name = "Aged Cheese"; SellIn = 2; Quality = 0}) + Items.Add({Name = "Coffee Table Book"; SellIn = 5; Quality = 7}) + Items.Add({Name = "Fine Italian Silk"; SellIn = 0; Quality = 80}) + Items.Add({Name = "Fine Italian Silk"; SellIn = -1; Quality = 80}) + Items.Add({Name = "Backstage passes to a concert"; SellIn = 15; Quality = 20}) + Items.Add({Name = "Backstage passes to a concert"; SellIn = 10; Quality = 49}) + Items.Add({Name = "Backstage passes to a concert"; SellIn = 5; Quality = 49}) + Items.Add({Name = "Baked Chocolate Cake"; SellIn = 3; Quality = 6}) let app = new GildedRose(Items) for i = 0 to 30 do @@ -62,4 +62,4 @@ module Program = printfn "%s, %d, %d" Items.[j].Name Items.[j].SellIn Items.[j].Quality printfn "" app.UpdateQuality() - 0 \ No newline at end of file + 0 diff --git a/fsharp/GildedRose/GildedRose.fs b/fsharp/GildedRose/GildedRose.fs index f14f4cc9..54ea0dce 100644 --- a/fsharp/GildedRose/GildedRose.fs +++ b/fsharp/GildedRose/GildedRose.fs @@ -9,48 +9,48 @@ type GildedRose(items:IList) as this = member this.UpdateQuality() = for i = 0 to Items.Count - 1 do - if Items.[i].Name <> "Aged Brie" && Items.[i].Name <> "Backstage passes to a TAFKAL80ETC concert" then + if Items.[i].Name <> "Aged Cheese" && Items.[i].Name <> "Backstage passes to a concert" then if Items.[i].Quality > 0 then - if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } + if Items.[i].Name <> "Fine Italian Silk" then + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } else if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } - if Items.[i].Name = "Backstage passes to a TAFKAL80ETC concert" then + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + if Items.[i].Name = "Backstage passes to a concert" then if Items.[i].SellIn < 11 then if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } if Items.[i].SellIn < 6 then if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } - if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then - Items.[i] <- { Items.[i] with SellIn = (Items.[i].SellIn - 1) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + if Items.[i].Name <> "Fine Italian Silk" then + Items.[i] <- { Items.[i] with SellIn = (Items.[i].SellIn - 1) } if Items.[i].SellIn < 0 then - if Items.[i].Name <> "Aged Brie" then - if Items.[i].Name <> "Backstage passes to a TAFKAL80ETC concert" then + if Items.[i].Name <> "Aged Cheese" then + if Items.[i].Name <> "Backstage passes to a concert" then if Items.[i].Quality > 0 then - if Items.[i].Name <> "Sulfuras, Hand of Ragnaros" then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } + if Items.[i].Name <> "Fine Italian Silk" then + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - 1) } else - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - Items.[i].Quality) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality - Items.[i].Quality) } else if Items.[i].Quality < 50 then - Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } + Items.[i] <- { Items.[i] with Quality = (Items.[i].Quality + 1) } () [] -let main argv = +let main argv = printfn "OMGHAI!" let Items = new List() - Items.Add({Name = "+5 Dexterity Vest"; SellIn = 10; Quality = 20}) - Items.Add({Name = "Aged Brie"; SellIn = 2; Quality = 0}) - Items.Add({Name = "Elixir of the Mongoose"; SellIn = 5; Quality = 7}) - Items.Add({Name = "Sulfuras, Hand of Ragnaros"; SellIn = 0; Quality = 80}) - Items.Add({Name = "Sulfuras, Hand of Ragnaros"; SellIn = -1; Quality = 80}) - Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 15; Quality = 20}) - Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 10; Quality = 49}) - Items.Add({Name = "Backstage passes to a TAFKAL80ETC concert"; SellIn = 5; Quality = 49}) - Items.Add({Name = "Conjured Mana Cake"; SellIn = 3; Quality = 6}) + Items.Add({Name = "Sports Memorabilia"; SellIn = 10; Quality = 20}) + Items.Add({Name = "Aged Cheese"; SellIn = 2; Quality = 0}) + Items.Add({Name = "Coffee Table Book"; SellIn = 5; Quality = 7}) + Items.Add({Name = "Fine Italian Silk"; SellIn = 0; Quality = 80}) + Items.Add({Name = "Fine Italian Silk"; SellIn = -1; Quality = 80}) + Items.Add({Name = "Backstage passes to a concert"; SellIn = 15; Quality = 20}) + Items.Add({Name = "Backstage passes to a concert"; SellIn = 10; Quality = 49}) + Items.Add({Name = "Backstage passes to a concert"; SellIn = 5; Quality = 49}) + Items.Add({Name = "Baked Chocolate Cake"; SellIn = 3; Quality = 6}) let app = new GildedRose(Items) for i = 0 to 30 do @@ -60,4 +60,4 @@ let main argv = printfn "%s, %d, %d" Items.[j].Name Items.[j].SellIn Items.[j].Quality printfn "" app.UpdateQuality() - 0 \ No newline at end of file + 0 diff --git a/go/gildedrose/gildedrose.go b/go/gildedrose/gildedrose.go index e0f17e12..c9f99d36 100644 --- a/go/gildedrose/gildedrose.go +++ b/go/gildedrose/gildedrose.go @@ -8,16 +8,16 @@ type Item struct { 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].Name != "Aged Cheese" && items[i].Name != "Backstage passes to a concert" { if items[i].Quality > 0 { - if items[i].Name != "Sulfuras, Hand of Ragnaros" { + if items[i].Name != "Fine Italian Silk" { 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].Name == "Backstage passes to a concert" { if items[i].SellIn < 11 { if items[i].Quality < 50 { items[i].Quality = items[i].Quality + 1 @@ -32,15 +32,15 @@ func UpdateQuality(items []*Item) { } } - if items[i].Name != "Sulfuras, Hand of Ragnaros" { + if items[i].Name != "Fine Italian Silk" { 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].Name != "Aged Cheese" { + if items[i].Name != "Backstage passes to a concert" { if items[i].Quality > 0 { - if items[i].Name != "Sulfuras, Hand of Ragnaros" { + if items[i].Name != "Fine Italian Silk" { items[i].Quality = items[i].Quality - 1 } } diff --git a/go/texttest_fixture.go b/go/texttest_fixture.go index 5c965064..b1664a1c 100644 --- a/go/texttest_fixture.go +++ b/go/texttest_fixture.go @@ -12,15 +12,15 @@ func main() { fmt.Println("OMGHAI!") var items = []*gildedrose.Item{ - {"+5 Dexterity Vest", 10, 20}, - {"Aged Brie", 2, 0}, - {"Elixir of the Mongoose", 5, 7}, - {"Sulfuras, Hand of Ragnaros", 0, 80}, - {"Sulfuras, Hand of Ragnaros", -1, 80}, - {"Backstage passes to a TAFKAL80ETC concert", 15, 20}, - {"Backstage passes to a TAFKAL80ETC concert", 10, 49}, - {"Backstage passes to a TAFKAL80ETC concert", 5, 49}, - {"Conjured Mana Cake", 3, 6}, // <-- :O + {"Sports Memorabilia", 10, 20}, + {"Aged Cheese", 2, 0}, + {"Coffee Table Book", 5, 7}, + {"Fine Italian Silk", 0, 80}, + {"Fine Italian Silk", -1, 80}, + {"Backstage passes to a concert", 15, 20}, + {"Backstage passes to a concert", 10, 49}, + {"Backstage passes to a concert", 5, 49}, + {"Baked Chocolate Cake", 3, 6}, // <-- :O } days := 2 diff --git a/haskell/src/GildedRose.hs b/haskell/src/GildedRose.hs index 8e710c8e..3551eab9 100644 --- a/haskell/src/GildedRose.hs +++ b/haskell/src/GildedRose.hs @@ -15,12 +15,12 @@ updateQuality = map updateQualityItem updateQualityItem (Item name sellIn quality) = let quality' = - if name /= "Aged Brie" - && name /= "Backstage passes to a TAFKAL80ETC concert" + if name /= "Aged Cheese" + && name /= "Backstage passes to a concert" then if quality > 0 then - if name /= "Sulfuras, Hand of Ragnaros" + if name /= "Fine Italian Silk" then quality - 1 else quality else quality @@ -28,7 +28,7 @@ updateQuality = map updateQualityItem if quality < 50 then quality + 1 + - (if name == "Backstage passes to a TAFKAL80ETC concert" + (if name == "Backstage passes to a concert" then if sellIn < 11 then @@ -46,19 +46,19 @@ updateQuality = map updateQualityItem else quality sellIn' = - if name /= "Sulfuras, Hand of Ragnaros" + if name /= "Fine Italian Silk" then sellIn - 1 else sellIn in if sellIn' < 0 then - if name /= "Aged Brie" + if name /= "Aged Cheese" then - if name /= "Backstage passes to a TAFKAL80ETC concert" + if name /= "Backstage passes to a concert" then if quality' > 0 then - if name /= "Sulfuras, Hand of Ragnaros" + if name /= "Fine Italian Silk" then (Item name sellIn' (quality' - 1)) else (Item name sellIn' quality') else (Item name sellIn' quality') diff --git a/haskell/src/Main.hs b/haskell/src/Main.hs index a5fad66c..0f59da9a 100644 --- a/haskell/src/Main.hs +++ b/haskell/src/Main.hs @@ -31,14 +31,14 @@ main = do initialInventory :: GildedRose initialInventory = - [ Item "+5 Dexterity Vest" 10 20 - , Item "Aged Brie" 2 0 - , Item "Elixir of the Mongoose" 5 7 - , Item "Sulfuras, Hand of Ragnaros" 0 80 - , Item "Sulfuras, Hand of Ragnaros" (-1) 80 - , Item "Backstage passes to a TAFKAL80ETC concert" 15 20 - , Item "Backstage passes to a TAFKAL80ETC concert" 10 49 - , Item "Backstage passes to a TAFKAL80ETC concert" 5 49 - -- this conjured item does not work properly yet - , Item "Conjured Mana Cake" 3 6 + [ Item "Sports Memorabilia" 10 20 + , Item "Aged Cheese" 2 0 + , Item "Coffee Table Book" 5 7 + , Item "Fine Italian Silk" 0 80 + , Item "Fine Italian Silk" (-1) 80 + , Item "Backstage passes to a concert" 15 20 + , Item "Backstage passes to a concert" 10 49 + , Item "Backstage passes to a concert" 5 49 + -- this Baked item does not work properly yet + , Item "Baked Chocolate Cake" 3 6 ] diff --git a/jq/gilded-rose.jq b/jq/gilded-rose.jq index e4096d57..55dbbe26 100644 --- a/jq/gilded-rose.jq +++ b/jq/gilded-rose.jq @@ -3,9 +3,9 @@ def update_quality: foreach .[] as $item ( null; $item | - if .name != "Aged Brie" and .name != "Backstage passes to a TAFKAL80ETC concert" then + if .name != "Aged Cheese" and .name != "Backstage passes to a concert" then if .quality > 0 then - if .name != "Sulfuras, Hand of Ragnaros" then + if .name != "Fine Italian Silk" then .quality = .quality - 1 else . end else . end @@ -13,7 +13,7 @@ def update_quality: if .quality < 50 then .quality = .quality + 1 | - if .name == "Backstage passes to a TAFKAL80ETC concert" then + if .name == "Backstage passes to a concert" then if .sell_in < 11 then if .quality < 50 then .quality = .quality + 1 @@ -29,15 +29,15 @@ def update_quality: else . end end | - if .name != "Sulfuras, Hand of Ragnaros" then + if .name != "Fine Italian Silk" then .sell_in = .sell_in - 1 else . end | if .sell_in < 0 then - if .name != "Aged Brie" then - if .name != "Backstage passes to a TAFKAL80ETC concert" then + if .name != "Aged Cheese" then + if .name != "Backstage passes to a concert" then if .quality > 0 then - if .name != "Sulfuras, Hand of Ragnaros" then + if .name != "Fine Italian Silk" then .quality = .quality - 1 else . end else . end diff --git a/jq/texttest_fixture.jq b/jq/texttest_fixture.jq index 12c08dc3..51b84191 100644 --- a/jq/texttest_fixture.jq +++ b/jq/texttest_fixture.jq @@ -1,15 +1,15 @@ "OMGHAI!", ( [ - { name: "+5 Dexterity Vest", sell_in: 10, quality: 20 }, - { name: "Aged Brie", sell_in: 2, quality: 0 }, - { name: "Elixir of the Mongoose", sell_in: 5, quality: 7 }, - { name: "Sulfuras, Hand of Ragnaros", sell_in: 0, quality: 80 }, - { name: "Sulfuras, Hand of Ragnaros", sell_in: -1, quality: 80 }, - { name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 15, quality: 20 }, - { name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 10, quality: 49 }, - { name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 5, quality: 49 }, - { name: "Conjured Mana Cake", sell_in: 3, quality: 6} # <-- :O + { name: "Sports Memorabilia", sell_in: 10, quality: 20 }, + { name: "Aged Cheese", sell_in: 2, quality: 0 }, + { name: "Coffee Table Book", sell_in: 5, quality: 7 }, + { name: "Fine Italian Silk", sell_in: 0, quality: 80 }, + { name: "Fine Italian Silk", sell_in: -1, quality: 80 }, + { name: "Backstage passes to a concert", sell_in: 15, quality: 20 }, + { name: "Backstage passes to a concert", sell_in: 10, quality: 49 }, + { name: "Backstage passes to a concert", sell_in: 5, quality: 49 }, + { name: "Baked Chocolate Cake", sell_in: 3, quality: 6} # <-- :O ] | { items: ., day: 0 } | recurse(.day += 1 | .items = (.items | update_quality); .day < ($ARGS.named.days // 2 | tonumber)) | diff --git a/js-jasmine/spec/texttest_fixture.js b/js-jasmine/spec/texttest_fixture.js index a62ede3f..cf5798db 100644 --- a/js-jasmine/spec/texttest_fixture.js +++ b/js-jasmine/spec/texttest_fixture.js @@ -2,17 +2,17 @@ const { Shop, Item } = require("../src/gilded_rose"); const items = [ - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), - // This Conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6), + // This Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6), ]; const days = Number(process.argv[2]) || 2; diff --git a/js-jasmine/src/gilded_rose.js b/js-jasmine/src/gilded_rose.js index acb33985..e40a1468 100644 --- a/js-jasmine/src/gilded_rose.js +++ b/js-jasmine/src/gilded_rose.js @@ -12,16 +12,16 @@ class Shop { } updateQuality() { for (var i = 0; i < this.items.length; i++) { - if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese' && this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1; } } } else { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1; - if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name == 'Backstage passes to a concert') { if (this.items[i].sellIn < 11) { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1; @@ -35,14 +35,14 @@ class Shop { } } } - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].sellIn = this.items[i].sellIn - 1; } if (this.items[i].sellIn < 0) { - if (this.items[i].name != 'Aged Brie') { - if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese') { + if (this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1; } } diff --git a/js-jest/src/gilded_rose.js b/js-jest/src/gilded_rose.js index 48746965..14219a5a 100644 --- a/js-jest/src/gilded_rose.js +++ b/js-jest/src/gilded_rose.js @@ -12,16 +12,16 @@ class Shop { } updateQuality() { for (let i = 0; i < this.items.length; i++) { - if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese' && this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1; } } } else { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1; - if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name == 'Backstage passes to a concert') { if (this.items[i].sellIn < 11) { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1; @@ -35,14 +35,14 @@ class Shop { } } } - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].sellIn = this.items[i].sellIn - 1; } if (this.items[i].sellIn < 0) { - if (this.items[i].name != 'Aged Brie') { - if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese') { + if (this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1; } } diff --git a/js-jest/test/texttest_fixture.js b/js-jest/test/texttest_fixture.js index a62ede3f..cf5798db 100644 --- a/js-jest/test/texttest_fixture.js +++ b/js-jest/test/texttest_fixture.js @@ -2,17 +2,17 @@ const { Shop, Item } = require("../src/gilded_rose"); const items = [ - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), - // This Conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6), + // This Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6), ]; const days = Number(process.argv[2]) || 2; diff --git a/js-mocha/src/gilded_rose.js b/js-mocha/src/gilded_rose.js index acb33985..e40a1468 100644 --- a/js-mocha/src/gilded_rose.js +++ b/js-mocha/src/gilded_rose.js @@ -12,16 +12,16 @@ class Shop { } updateQuality() { for (var i = 0; i < this.items.length; i++) { - if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese' && this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1; } } } else { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1; - if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name == 'Backstage passes to a concert') { if (this.items[i].sellIn < 11) { if (this.items[i].quality < 50) { this.items[i].quality = this.items[i].quality + 1; @@ -35,14 +35,14 @@ class Shop { } } } - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].sellIn = this.items[i].sellIn - 1; } if (this.items[i].sellIn < 0) { - if (this.items[i].name != 'Aged Brie') { - if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') { + if (this.items[i].name != 'Aged Cheese') { + if (this.items[i].name != 'Backstage passes to a concert') { if (this.items[i].quality > 0) { - if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { + if (this.items[i].name != 'Fine Italian Silk') { this.items[i].quality = this.items[i].quality - 1; } } diff --git a/js-mocha/test/texttest_fixture.js b/js-mocha/test/texttest_fixture.js index a62ede3f..cf5798db 100644 --- a/js-mocha/test/texttest_fixture.js +++ b/js-mocha/test/texttest_fixture.js @@ -2,17 +2,17 @@ const { Shop, Item } = require("../src/gilded_rose"); const items = [ - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), - // This Conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6), + // This Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6), ]; const days = Number(process.argv[2]) || 2; diff --git a/julia/gilded_rose.jl b/julia/gilded_rose.jl index b17d20c9..a776c35c 100644 --- a/julia/gilded_rose.jl +++ b/julia/gilded_rose.jl @@ -14,16 +14,16 @@ end function update_quality!(gr::GildedRose) for item in gr.items - if item.name != "Aged Brie" && item.name != "Backstage passes to a TAFKAL80ETC concert" + if item.name != "Aged Cheese" && item.name != "Backstage passes to a concert" if item.quality > 0 - if item.name != "Sulfuras, Hand of Ragnaros" + if item.name != "Fine Italian Silk" item.quality = item.quality - 1 end end else if item.quality < 50 item.quality = item.quality + 1 - if item.name == "Backstage passes to a TAFKAL80ETC concert" + if item.name == "Backstage passes to a concert" if item.sellin < 11 if item.quality < 50 item.quality = item.quality + 1 @@ -37,14 +37,14 @@ function update_quality!(gr::GildedRose) end end end - if item.name != "Sulfuras, Hand of Ragnaros" + if item.name != "Fine Italian Silk" item.sellin = item.sellin - 1 end if item.sellin < 0 - if item.name != "Aged Brie" - if item.name != "Backstage passes to a TAFKAL80ETC concert" + if item.name != "Aged Cheese" + if item.name != "Backstage passes to a concert" if item.quality > 0 - if item.name != "Sulfuras, Hand of Ragnaros" + if item.name != "Fine Italian Silk" item.quality = item.quality - 1 end end @@ -68,15 +68,15 @@ end function main(; days::Int64=2) println("OMGHAI!") items = [ - Item("+5 Dexterity Vest", 10, 20), - Item("Aged Brie", 2, 0), - Item("Elixir of the Mongoose", 5, 7), - Item("Sulfuras, Hand of Ragnaros", 0, 80), - Item("Sulfuras, Hand of Ragnaros", -1, 80), - Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - Item("Conjured Mana Cake", 3, 6), + Item("Sports Memorabilia", 10, 20), + Item("Aged Cheese", 2, 0), + Item("Coffee Table Book", 5, 7), + Item("Fine Italian Silk", 0, 80), + Item("Fine Italian Silk", -1, 80), + Item("Backstage passes to a concert", 15, 20), + Item("Backstage passes to a concert", 10, 49), + Item("Backstage passes to a concert", 5, 49), + Item("Baked Chocolate Cake", 3, 6), ] for day in 1:days println("-------- day $day --------") diff --git a/lfe/src/gilded-rose.lfe b/lfe/src/gilded-rose.lfe index a135ecc7..2c08e422 100644 --- a/lfe/src/gilded-rose.lfe +++ b/lfe/src/gilded-rose.lfe @@ -15,16 +15,16 @@ ;; Pretty simple, right? Well this is where it gets interesting: ;; Once the sell by date has passed, Quality degrades twice as fast ;; The Quality of an item is never negative -;; "Aged Brie" actually increases in Quality the older it gets +;; "Aged Cheese" actually increases in Quality the older it gets ;; The Quality of an item is never more than 50 -;; "Sulfuras", being a legendary item, never has to be sold or decreases in Quality -;; "Backstage passes", like aged brie, increases in Quality as it's +;; "Fine Italian Silk", being a luxury item, never has to be sold or decreases in Quality +;; "Backstage passes", like Aged Cheese, increases in Quality as it's ;; SellIn value approaches; Quality increases by 2 when there are 10 ;; days or less and by 3 when there are 5 days or less but Quality ;; drops to 0 after the concert -;; We have recently signed a supplier of conjured items. This requires an update to our system: -;; "Conjured" items degrade in Quality twice as fast as normal items +;; We have recently signed a supplier of Baked items. This requires an update to our system: +;; "Baked" items degrade in Quality twice as fast as normal items ;; Feel free to make any changes to the UpdateQuality method and add ;; any new code as long as everything still works correctly. However, ;; do not alter the Item class or Items property as those belong to the @@ -33,7 +33,7 @@ ;; UpdateQuality method and Items property static if you like, we'll ;; cover for you). ;; Just for clarification, an item can never have its Quality increase -;; above 50, however "Sulfuras" is a legendary item and as such its +;; above 50, however "Fine Italian Silk" is a luxury item and as such its ;; Quality is 80 and it never alters. ;; https://github.com/emilybache/GildedRose-Refactoring-Kata @@ -55,19 +55,19 @@ (defun update-item (item) (let* ((item (if (and (not (string:equal (item-name item) - "Aged Brie")) + "Aged Cheese")) (not (string:equal (item-name item) - "Backstage passes to a TAFKAL80ETC concert"))) + "Backstage passes to a concert"))) (if (> (item-quality item) 0) (if (not (string:equal (item-name item) - "Sulfuras, Hand of Ragnaros")) + "Fine Italian Silk")) (set-item-quality item (- (item-quality item) 1)) item) item) (if (< (item-quality item) 50) (set-item-quality item (+ (item-quality item) 1)) (if (string:equal (item-name item) - "Backstage passes to a TAFKAL80ETC concert") + "Backstage passes to a concert") (if (< (item-sellin item) 11) (if (< (item-quality item) 50) (set-item-quality item (+ (item-quality item) 1)) @@ -79,17 +79,17 @@ item) item))))) (item (if (not (string:equal (item-name item) - "Sulfuras, Hand of Ragnaros")) + "Fine Italian Silk")) (set-item-sellin item (- (item-sellin item) 1)) item))) (if (< (item-sellin item) 0) (if (not (string:equal (item-name item) - "Aged Brie")) + "Aged Cheese")) (if (not (string:equal (item-name item) - "Backstage passes to a TAFKAL80ETC concert")) + "Backstage passes to a concert")) (if (> (item-quality item) 0) (if (not (string:equal (item-name item) - "Sulfuras, Hand of Ragnaros")) + "Fine Italian Silk")) (set-item-quality item (- (item-quality item) 1)) item) item) @@ -114,16 +114,16 @@ (defun run-gilded-rose (days) (io:format "OMGHAI!~n") - (let ((items (list (make-item name "+5 Dexterity Vest" sellin 10 quality 20) - (make-item name "Aged Brie" sellin 2 quality 0) - (make-item name "Elixir of the Mongoose" sellin 5 quality 7) - (make-item name "Sulfuras, Hand of Ragnaros" sellin 0 quality 80) - (make-item name "Sulfuras, Hand of Ragnaros" sellin -1 quality 80) - (make-item name "Backstage passes to a TAFKAL80ETC concert" sellin 15 quality 20) - (make-item name "Backstage passes to a TAFKAL80ETC concert" sellin 10 quality 49) - (make-item name "Backstage passes to a TAFKAL80ETC concert" sellin 5 quality 49) - ;; this conjured item does not work properly yet - (make-item name "Conjured Mana Cake" sellin 3 quality 6)))) + (let ((items (list (make-item name "Sports Memorabilia" sellin 10 quality 20) + (make-item name "Aged Cheese" sellin 2 quality 0) + (make-item name "Coffee Table Book" sellin 5 quality 7) + (make-item name "Fine Italian Silk" sellin 0 quality 80) + (make-item name "Fine Italian Silk" sellin -1 quality 80) + (make-item name "Backstage passes to a concert" sellin 15 quality 20) + (make-item name "Backstage passes to a concert" sellin 10 quality 49) + (make-item name "Backstage passes to a concert" sellin 5 quality 49) + ;; this Baked item does not work properly yet + (make-item name "Baked Chocolate Cake" sellin 3 quality 6)))) (lists:foldl (lambda (day gr) (print-day day (gilded-rose-items gr)) diff --git a/pascal/ROSE.PAS b/pascal/ROSE.PAS index f78f3057..4b8d6af7 100644 --- a/pascal/ROSE.PAS +++ b/pascal/ROSE.PAS @@ -61,12 +61,12 @@ var I: Word; begin for I := 0 to Items.Length-1 do begin - if (Items.Elements^[I].Name <> 'Aged Brie') and - (Items.Elements^[I].Name <> 'Backstage passes to a TAFKAL80ETC concert') then + if (Items.Elements^[I].Name <> 'Aged Cheese') and + (Items.Elements^[I].Name <> 'Backstage passes to a concert') then begin if Items.Elements^[I].Quality > 0 then begin - if Items.Elements^[I].Name <> 'Sulfuras, Hand of Ragnaros' then + if Items.Elements^[I].Name <> 'Fine Italian Silk' then begin Items.Elements^[I].Quality := Items.Elements^[I].Quality - 1; end; @@ -78,7 +78,7 @@ begin begin Items.Elements^[I].Quality := Items.Elements^[I].Quality + 1; - if Items.Elements^[I].Name = 'Backstage passes to a TAFKAL80ETC concert' then + if Items.Elements^[I].Name = 'Backstage passes to a concert' then begin if Items.Elements^[I].SellIn < 11 then begin @@ -99,20 +99,20 @@ begin end; end; - if Items.Elements^[I].Name <> 'Sulfuras, Hand of Ragnaros' then + if Items.Elements^[I].Name <> 'Fine Italian Silk' then begin Items.Elements^[I].SellIn := Items.Elements^[I].SellIn - 1; end; if Items.Elements^[I].SellIn < 0 then begin - if Items.Elements^[I].Name <> 'Aged Brie' then + if Items.Elements^[I].Name <> 'Aged Cheese' then begin - if Items.Elements^[I].Name <> 'Backstage passes to a TAFKAL80ETC concert' then + if Items.Elements^[I].Name <> 'Backstage passes to a concert' then begin if Items.Elements^[I].Quality > 0 then begin - if Items.Elements^[I].Name <> 'Sulfuras, Hand of Ragnaros' then + if Items.Elements^[I].Name <> 'Fine Italian Silk' then begin Items.Elements^[I].Quality := Items.Elements^[I].Quality - 1; end; diff --git a/pascal/TEXTTEST.PAS b/pascal/TEXTTEST.PAS index dc06febc..177e8d55 100644 --- a/pascal/TEXTTEST.PAS +++ b/pascal/TEXTTEST.PAS @@ -14,24 +14,24 @@ begin ResizeList(Items, 9); Last := 0; - InitItem(Items.Elements^[Last], '+5 Dexterity Vest', 10, 20); + InitItem(Items.Elements^[Last], 'Sports Memorabilia', 10, 20); Inc(Last); - InitItem(Items.Elements^[Last], 'Aged Brie', 2, 0); + InitItem(Items.Elements^[Last], 'Aged Cheese', 2, 0); Inc(Last); - InitItem(Items.Elements^[Last], 'Elixir of the Mongoose', 5, 7); + InitItem(Items.Elements^[Last], 'Coffee Table Book', 5, 7); Inc(Last); - InitItem(Items.Elements^[Last], 'Sulfuras, Hand of Ragnaros', 0, 80); + InitItem(Items.Elements^[Last], 'Fine Italian Silk', 0, 80); Inc(Last); - InitItem(Items.Elements^[Last], 'Sulfuras, Hand of Ragnaros', -1, 80); + InitItem(Items.Elements^[Last], 'Fine Italian Silk', -1, 80); Inc(Last); - InitItem(Items.Elements^[Last], 'Backstage passes to a TAFKAL80ETC concert', 15, 20); + InitItem(Items.Elements^[Last], 'Backstage passes to a concert', 15, 20); Inc(Last); - InitItem(Items.Elements^[Last], 'Backstage passes to a TAFKAL80ETC concert', 10, 49); + InitItem(Items.Elements^[Last], 'Backstage passes to a concert', 10, 49); Inc(Last); - InitItem(Items.Elements^[Last], 'Backstage passes to a TAFKAL80ETC concert', 5, 49); + InitItem(Items.Elements^[Last], 'Backstage passes to a concert', 5, 49); Inc(Last); - { this Conjured item doesn't yet work properly } - InitItem(Items.Elements^[Last], 'Conjured Mana Cake', 3, 6); + { this Baked item doesn't yet work properly } + InitItem(Items.Elements^[Last], 'Baked Chocolate Cake', 3, 6); Inc(Last); Items.Length := Last; diff --git a/perl/GildedRose.pm b/perl/GildedRose.pm index 7cc74a1e..eb7a04fc 100644 --- a/perl/GildedRose.pm +++ b/perl/GildedRose.pm @@ -11,11 +11,11 @@ sub new { sub update_quality { my $self = shift; for my $item ( @{ $self->{items} } ) { - if ( $item->{name} ne 'Aged Brie' - && $item->{name} ne 'Backstage passes to a TAFKAL80ETC concert' ) + if ( $item->{name} ne 'Aged Cheese' + && $item->{name} ne 'Backstage passes to a concert' ) { if ( $item->{quality} > 0 ) { - if ( $item->{name} ne 'Sulfuras, Hand of Ragnaros' ) { + if ( $item->{name} ne 'Fine Italian Silk' ) { $item->{quality} = $item->{quality} - 1; } } @@ -25,7 +25,7 @@ sub update_quality { $item->{quality} = $item->{quality} + 1; if ( $item->{name} eq - 'Backstage passes to a TAFKAL80ETC concert' ) + 'Backstage passes to a concert' ) { if ( $item->{sell_in} < 11 ) { if ( $item->{quality} < 50 ) { @@ -42,17 +42,17 @@ sub update_quality { } } - if ( $item->{name} ne 'Sulfuras, Hand of Ragnaros' ) { + if ( $item->{name} ne 'Fine Italian Silk' ) { $item->{sell_in} = $item->{sell_in} - 1; } if ( $item->{sell_in} < 0 ) { - if ( $item->{name} ne 'Aged Brie' ) { + if ( $item->{name} ne 'Aged Cheese' ) { if ( $item->{name} ne - 'Backstage passes to a TAFKAL80ETC concert' ) + 'Backstage passes to a concert' ) { if ( $item->{quality} > 0 ) { - if ( $item->{name} ne 'Sulfuras, Hand of Ragnaros' ) { + if ( $item->{name} ne 'Fine Italian Silk' ) { $item->{quality} = $item->{quality} - 1; } } diff --git a/perl/texttest_fixture.pl b/perl/texttest_fixture.pl index 565a8b61..bcdabc39 100755 --- a/perl/texttest_fixture.pl +++ b/perl/texttest_fixture.pl @@ -9,47 +9,47 @@ use Item; print 'OMGHAI!', "\n"; my $items = [ Item->new( - name => '+5 Dexterity Vest', + name => 'Sports Memorabilia', sell_in => 10, quality => 20 ), Item->new( - name => 'Aged Brie', + name => 'Aged Cheese', sell_in => 2, quality => 0 ), Item->new( - name => 'Elixir of the Mongoose', + name => 'Coffee Table Book', sell_in => 5, quality => 7 ), Item->new( - name => 'Sulfuras, Hand of Ragnaros', + name => 'Fine Italian Silk', sell_in => 0, quality => 80 ), Item->new( - name => 'Sulfuras, Hand of Ragnaros', + name => 'Fine Italian Silk', sell_in => -1, quality => 80 ), Item->new( - name => 'Backstage passes to a TAFKAL80ETC concert', + name => 'Backstage passes to a concert', sell_in => 15, quality => 20 ), Item->new( - name => 'Backstage passes to a TAFKAL80ETC concert', + name => 'Backstage passes to a concert', sell_in => 10, quality => 49 ), Item->new( - name => 'Backstage passes to a TAFKAL80ETC concert', + name => 'Backstage passes to a concert', sell_in => 5, quality => 49 ), - Item->new( # This Conjured item does not work properly yet - name => 'Conjured Mana Cake', + Item->new( # This Baked item does not work properly yet + name => 'Baked Chocolate Cake', sell_in => 3, quality => 6 ), diff --git a/perl6/lib/GildedRose.pm6 b/perl6/lib/GildedRose.pm6 index eae84d95..e28852ad 100644 --- a/perl6/lib/GildedRose.pm6 +++ b/perl6/lib/GildedRose.pm6 @@ -7,9 +7,9 @@ class GildedRose { method update_quality { for @!items -> $item { - if ($item.name ne 'Aged Brie' && $item.name ne 'Backstage passes to a TAFKAL80ETC concert') { + if ($item.name ne 'Aged Cheese' && $item.name ne 'Backstage passes to a concert') { if ( $item.quality > 0 ) { - if ( $item.name ne 'Sulfuras, Hand of Ragnaros' ) { + if ( $item.name ne 'Fine Italian Silk' ) { $item.quality = $item.quality - 1; } } @@ -18,7 +18,7 @@ class GildedRose { if ( $item.quality < 50 ) { $item.quality = $item.quality + 1; - if ( $item.name eq 'Backstage passes to a TAFKAL80ETC concert' ) + if ( $item.name eq 'Backstage passes to a concert' ) { if ( $item.sell_in < 11 ) { if ( $item.quality < 50 ) { @@ -35,17 +35,17 @@ class GildedRose { } } - if ( $item.name ne 'Sulfuras, Hand of Ragnaros' ) { + if ( $item.name ne 'Fine Italian Silk' ) { $item.sell_in = $item.sell_in - 1; } if ( $item.sell_in < 0 ) { - if ( $item.name ne 'Aged Brie' ) { + if ( $item.name ne 'Aged Cheese' ) { if ( $item.name ne - 'Backstage passes to a TAFKAL80ETC concert' ) + 'Backstage passes to a concert' ) { if ( $item.quality > 0 ) { - if ( $item.name ne 'Sulfuras, Hand of Ragnaros' ) { + if ( $item.name ne 'Fine Italian Silk' ) { $item.quality = $item.quality - 1; } } diff --git a/perl6/texttest_fixture.p6 b/perl6/texttest_fixture.p6 index d3e405d7..a6f06a72 100755 --- a/perl6/texttest_fixture.p6 +++ b/perl6/texttest_fixture.p6 @@ -10,47 +10,47 @@ use Item; print 'OMGHAI!', "\n"; my @items = ( Item.new( - name => '+5 Dexterity Vest', + name => 'Sports Memorabilia', sell_in => 10, quality => 20 ), Item.new( - name => 'Aged Brie', + name => 'Aged Cheese', sell_in => 2, quality => 0 ), Item.new( - name => 'Elixir of the Mongoose', + name => 'Coffee Table Book', sell_in => 5, quality => 7 ), Item.new( - name => 'Sulfuras, Hand of Ragnaros', + name => 'Fine Italian Silk', sell_in => 0, quality => 80 ), Item.new( - name => 'Sulfuras, Hand of Ragnaros', + name => 'Fine Italian Silk', sell_in => -1, quality => 80 ), Item.new( - name => 'Backstage passes to a TAFKAL80ETC concert', + name => 'Backstage passes to a concert', sell_in => 15, quality => 20 ), Item.new( - name => 'Backstage passes to a TAFKAL80ETC concert', + name => 'Backstage passes to a concert', sell_in => 10, quality => 49 ), Item.new( - name => 'Backstage passes to a TAFKAL80ETC concert', + name => 'Backstage passes to a concert', sell_in => 5, quality => 49 ), - Item.new( # This Conjured item does not work properly yet - name => 'Conjured Mana Cake', + Item.new( # This Baked item does not work properly yet + name => 'Baked Chocolate Cake', sell_in => 3, quality => 6 ), diff --git a/php/fixtures/texttest_fixture.php b/php/fixtures/texttest_fixture.php index 2c2cb1c5..109913e6 100644 --- a/php/fixtures/texttest_fixture.php +++ b/php/fixtures/texttest_fixture.php @@ -10,16 +10,16 @@ use GildedRose\Item; echo 'OMGHAI!' . PHP_EOL; $items = [ - new Item('+5 Dexterity Vest', 10, 20), - new Item('Aged Brie', 2, 0), - new Item('Elixir of the Mongoose', 5, 7), - new Item('Sulfuras, Hand of Ragnaros', 0, 80), - new Item('Sulfuras, Hand of Ragnaros', -1, 80), - new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20), - new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49), - new Item('Backstage passes to a TAFKAL80ETC concert', 5, 49), - // this conjured item does not work properly yet - new Item('Conjured Mana Cake', 3, 6), + new Item('Sports Memorabilia', 10, 20), + new Item('Aged Cheese', 2, 0), + new Item('Coffee Table Book', 5, 7), + new Item('Fine Italian Silk', 0, 80), + new Item('Fine Italian Silk', -1, 80), + new Item('Backstage passes to a concert', 15, 20), + new Item('Backstage passes to a concert', 10, 49), + new Item('Backstage passes to a concert', 5, 49), + // this Baked item does not work properly yet + new Item('Baked Chocolate Cake', 3, 6), ]; $app = new GildedRose($items); diff --git a/php/src/GildedRose.php b/php/src/GildedRose.php index db81ee3b..77b69fba 100644 --- a/php/src/GildedRose.php +++ b/php/src/GildedRose.php @@ -17,16 +17,16 @@ final class GildedRose public function updateQuality(): void { foreach ($this->items as $item) { - if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') { + if ($item->name != 'Aged Cheese' and $item->name != 'Backstage passes to a concert') { if ($item->quality > 0) { - if ($item->name != 'Sulfuras, Hand of Ragnaros') { + if ($item->name != 'Fine Italian Silk') { $item->quality = $item->quality - 1; } } } else { if ($item->quality < 50) { $item->quality = $item->quality + 1; - if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') { + if ($item->name == 'Backstage passes to a concert') { if ($item->sellIn < 11) { if ($item->quality < 50) { $item->quality = $item->quality + 1; @@ -41,15 +41,15 @@ final class GildedRose } } - if ($item->name != 'Sulfuras, Hand of Ragnaros') { + if ($item->name != 'Fine Italian Silk') { $item->sellIn = $item->sellIn - 1; } if ($item->sellIn < 0) { - if ($item->name != 'Aged Brie') { - if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') { + if ($item->name != 'Aged Cheese') { + if ($item->name != 'Backstage passes to a concert') { if ($item->quality > 0) { - if ($item->name != 'Sulfuras, Hand of Ragnaros') { + if ($item->name != 'Fine Italian Silk') { $item->quality = $item->quality - 1; } } diff --git a/php/tests/approvals/ApprovalTest.testTestFixture.approved.txt b/php/tests/approvals/ApprovalTest.testTestFixture.approved.txt index a04e48ac..75ba4b52 100644 --- a/php/tests/approvals/ApprovalTest.testTestFixture.approved.txt +++ b/php/tests/approvals/ApprovalTest.testTestFixture.approved.txt @@ -1,373 +1,373 @@ OMGHAI! -------- day 0 -------- name, sellIn, quality -+5 Dexterity Vest, 10, 20 -Aged Brie, 2, 0 -Elixir of the Mongoose, 5, 7 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 15, 20 -Backstage passes to a TAFKAL80ETC concert, 10, 49 -Backstage passes to a TAFKAL80ETC concert, 5, 49 -Conjured Mana Cake, 3, 6 +Sports Memorabilia, 10, 20 +Aged Cheese, 2, 0 +Coffee Table Book, 5, 7 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 15, 20 +Backstage passes to a concert, 10, 49 +Backstage passes to a concert, 5, 49 +Baked Chocolate Cake, 3, 6 -------- day 1 -------- name, sellIn, quality -+5 Dexterity Vest, 9, 19 -Aged Brie, 1, 1 -Elixir of the Mongoose, 4, 6 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 14, 21 -Backstage passes to a TAFKAL80ETC concert, 9, 50 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Conjured Mana Cake, 2, 5 +Sports Memorabilia, 9, 19 +Aged Cheese, 1, 1 +Coffee Table Book, 4, 6 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 14, 21 +Backstage passes to a concert, 9, 50 +Backstage passes to a concert, 4, 50 +Baked Chocolate Cake, 2, 5 -------- day 2 -------- name, sellIn, quality -+5 Dexterity Vest, 8, 18 -Aged Brie, 0, 2 -Elixir of the Mongoose, 3, 5 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 13, 22 -Backstage passes to a TAFKAL80ETC concert, 8, 50 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Conjured Mana Cake, 1, 4 +Sports Memorabilia, 8, 18 +Aged Cheese, 0, 2 +Coffee Table Book, 3, 5 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 13, 22 +Backstage passes to a concert, 8, 50 +Backstage passes to a concert, 3, 50 +Baked Chocolate Cake, 1, 4 -------- day 3 -------- name, sellIn, quality -+5 Dexterity Vest, 7, 17 -Aged Brie, -1, 4 -Elixir of the Mongoose, 2, 4 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 12, 23 -Backstage passes to a TAFKAL80ETC concert, 7, 50 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Conjured Mana Cake, 0, 3 +Sports Memorabilia, 7, 17 +Aged Cheese, -1, 4 +Coffee Table Book, 2, 4 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 12, 23 +Backstage passes to a concert, 7, 50 +Backstage passes to a concert, 2, 50 +Baked Chocolate Cake, 0, 3 -------- day 4 -------- name, sellIn, quality -+5 Dexterity Vest, 6, 16 -Aged Brie, -2, 6 -Elixir of the Mongoose, 1, 3 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 11, 24 -Backstage passes to a TAFKAL80ETC concert, 6, 50 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Conjured Mana Cake, -1, 1 +Sports Memorabilia, 6, 16 +Aged Cheese, -2, 6 +Coffee Table Book, 1, 3 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 11, 24 +Backstage passes to a concert, 6, 50 +Backstage passes to a concert, 1, 50 +Baked Chocolate Cake, -1, 1 -------- day 5 -------- name, sellIn, quality -+5 Dexterity Vest, 5, 15 -Aged Brie, -3, 8 -Elixir of the Mongoose, 0, 2 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 10, 25 -Backstage passes to a TAFKAL80ETC concert, 5, 50 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Conjured Mana Cake, -2, 0 +Sports Memorabilia, 5, 15 +Aged Cheese, -3, 8 +Coffee Table Book, 0, 2 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 10, 25 +Backstage passes to a concert, 5, 50 +Backstage passes to a concert, 0, 50 +Baked Chocolate Cake, -2, 0 -------- day 6 -------- name, sellIn, quality -+5 Dexterity Vest, 4, 14 -Aged Brie, -4, 10 -Elixir of the Mongoose, -1, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 9, 27 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Conjured Mana Cake, -3, 0 +Sports Memorabilia, 4, 14 +Aged Cheese, -4, 10 +Coffee Table Book, -1, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 9, 27 +Backstage passes to a concert, 4, 50 +Backstage passes to a concert, -1, 0 +Baked Chocolate Cake, -3, 0 -------- day 7 -------- name, sellIn, quality -+5 Dexterity Vest, 3, 13 -Aged Brie, -5, 12 -Elixir of the Mongoose, -2, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 8, 29 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Conjured Mana Cake, -4, 0 +Sports Memorabilia, 3, 13 +Aged Cheese, -5, 12 +Coffee Table Book, -2, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 8, 29 +Backstage passes to a concert, 3, 50 +Backstage passes to a concert, -2, 0 +Baked Chocolate Cake, -4, 0 -------- day 8 -------- name, sellIn, quality -+5 Dexterity Vest, 2, 12 -Aged Brie, -6, 14 -Elixir of the Mongoose, -3, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 7, 31 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Conjured Mana Cake, -5, 0 +Sports Memorabilia, 2, 12 +Aged Cheese, -6, 14 +Coffee Table Book, -3, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 7, 31 +Backstage passes to a concert, 2, 50 +Backstage passes to a concert, -3, 0 +Baked Chocolate Cake, -5, 0 -------- day 9 -------- name, sellIn, quality -+5 Dexterity Vest, 1, 11 -Aged Brie, -7, 16 -Elixir of the Mongoose, -4, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 6, 33 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Conjured Mana Cake, -6, 0 +Sports Memorabilia, 1, 11 +Aged Cheese, -7, 16 +Coffee Table Book, -4, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 6, 33 +Backstage passes to a concert, 1, 50 +Backstage passes to a concert, -4, 0 +Baked Chocolate Cake, -6, 0 -------- day 10 -------- name, sellIn, quality -+5 Dexterity Vest, 0, 10 -Aged Brie, -8, 18 -Elixir of the Mongoose, -5, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 5, 35 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Conjured Mana Cake, -7, 0 +Sports Memorabilia, 0, 10 +Aged Cheese, -8, 18 +Coffee Table Book, -5, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 5, 35 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Baked Chocolate Cake, -7, 0 -------- day 11 -------- name, sellIn, quality -+5 Dexterity Vest, -1, 8 -Aged Brie, -9, 20 -Elixir of the Mongoose, -6, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 4, 38 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Conjured Mana Cake, -8, 0 +Sports Memorabilia, -1, 8 +Aged Cheese, -9, 20 +Coffee Table Book, -6, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 4, 38 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Baked Chocolate Cake, -8, 0 -------- day 12 -------- name, sellIn, quality -+5 Dexterity Vest, -2, 6 -Aged Brie, -10, 22 -Elixir of the Mongoose, -7, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 3, 41 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Conjured Mana Cake, -9, 0 +Sports Memorabilia, -2, 6 +Aged Cheese, -10, 22 +Coffee Table Book, -7, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 3, 41 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Baked Chocolate Cake, -9, 0 -------- day 13 -------- name, sellIn, quality -+5 Dexterity Vest, -3, 4 -Aged Brie, -11, 24 -Elixir of the Mongoose, -8, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 2, 44 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Conjured Mana Cake, -10, 0 +Sports Memorabilia, -3, 4 +Aged Cheese, -11, 24 +Coffee Table Book, -8, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 2, 44 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Baked Chocolate Cake, -10, 0 -------- day 14 -------- name, sellIn, quality -+5 Dexterity Vest, -4, 2 -Aged Brie, -12, 26 -Elixir of the Mongoose, -9, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 1, 47 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Conjured Mana Cake, -11, 0 +Sports Memorabilia, -4, 2 +Aged Cheese, -12, 26 +Coffee Table Book, -9, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 1, 47 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Baked Chocolate Cake, -11, 0 -------- day 15 -------- name, sellIn, quality -+5 Dexterity Vest, -5, 0 -Aged Brie, -13, 28 -Elixir of the Mongoose, -10, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Conjured Mana Cake, -12, 0 +Sports Memorabilia, -5, 0 +Aged Cheese, -13, 28 +Coffee Table Book, -10, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Baked Chocolate Cake, -12, 0 -------- day 16 -------- name, sellIn, quality -+5 Dexterity Vest, -6, 0 -Aged Brie, -14, 30 -Elixir of the Mongoose, -11, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Conjured Mana Cake, -13, 0 +Sports Memorabilia, -6, 0 +Aged Cheese, -14, 30 +Coffee Table Book, -11, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Baked Chocolate Cake, -13, 0 -------- day 17 -------- name, sellIn, quality -+5 Dexterity Vest, -7, 0 -Aged Brie, -15, 32 -Elixir of the Mongoose, -12, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Conjured Mana Cake, -14, 0 +Sports Memorabilia, -7, 0 +Aged Cheese, -15, 32 +Coffee Table Book, -12, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Baked Chocolate Cake, -14, 0 -------- day 18 -------- name, sellIn, quality -+5 Dexterity Vest, -8, 0 -Aged Brie, -16, 34 -Elixir of the Mongoose, -13, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Conjured Mana Cake, -15, 0 +Sports Memorabilia, -8, 0 +Aged Cheese, -16, 34 +Coffee Table Book, -13, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Baked Chocolate Cake, -15, 0 -------- day 19 -------- name, sellIn, quality -+5 Dexterity Vest, -9, 0 -Aged Brie, -17, 36 -Elixir of the Mongoose, -14, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Conjured Mana Cake, -16, 0 +Sports Memorabilia, -9, 0 +Aged Cheese, -17, 36 +Coffee Table Book, -14, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Baked Chocolate Cake, -16, 0 -------- day 20 -------- name, sellIn, quality -+5 Dexterity Vest, -10, 0 -Aged Brie, -18, 38 -Elixir of the Mongoose, -15, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Conjured Mana Cake, -17, 0 +Sports Memorabilia, -10, 0 +Aged Cheese, -18, 38 +Coffee Table Book, -15, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Baked Chocolate Cake, -17, 0 -------- day 21 -------- name, sellIn, quality -+5 Dexterity Vest, -11, 0 -Aged Brie, -19, 40 -Elixir of the Mongoose, -16, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Conjured Mana Cake, -18, 0 +Sports Memorabilia, -11, 0 +Aged Cheese, -19, 40 +Coffee Table Book, -16, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Baked Chocolate Cake, -18, 0 -------- day 22 -------- name, sellIn, quality -+5 Dexterity Vest, -12, 0 -Aged Brie, -20, 42 -Elixir of the Mongoose, -17, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Conjured Mana Cake, -19, 0 +Sports Memorabilia, -12, 0 +Aged Cheese, -20, 42 +Coffee Table Book, -17, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Baked Chocolate Cake, -19, 0 -------- day 23 -------- name, sellIn, quality -+5 Dexterity Vest, -13, 0 -Aged Brie, -21, 44 -Elixir of the Mongoose, -18, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Conjured Mana Cake, -20, 0 +Sports Memorabilia, -13, 0 +Aged Cheese, -21, 44 +Coffee Table Book, -18, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Baked Chocolate Cake, -20, 0 -------- day 24 -------- name, sellIn, quality -+5 Dexterity Vest, -14, 0 -Aged Brie, -22, 46 -Elixir of the Mongoose, -19, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Conjured Mana Cake, -21, 0 +Sports Memorabilia, -14, 0 +Aged Cheese, -22, 46 +Coffee Table Book, -19, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Baked Chocolate Cake, -21, 0 -------- day 25 -------- name, sellIn, quality -+5 Dexterity Vest, -15, 0 -Aged Brie, -23, 48 -Elixir of the Mongoose, -20, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Conjured Mana Cake, -22, 0 +Sports Memorabilia, -15, 0 +Aged Cheese, -23, 48 +Coffee Table Book, -20, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Baked Chocolate Cake, -22, 0 -------- day 26 -------- name, sellIn, quality -+5 Dexterity Vest, -16, 0 -Aged Brie, -24, 50 -Elixir of the Mongoose, -21, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Backstage passes to a TAFKAL80ETC concert, -21, 0 -Conjured Mana Cake, -23, 0 +Sports Memorabilia, -16, 0 +Aged Cheese, -24, 50 +Coffee Table Book, -21, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Backstage passes to a concert, -21, 0 +Baked Chocolate Cake, -23, 0 -------- day 27 -------- name, sellIn, quality -+5 Dexterity Vest, -17, 0 -Aged Brie, -25, 50 -Elixir of the Mongoose, -22, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Backstage passes to a TAFKAL80ETC concert, -22, 0 -Conjured Mana Cake, -24, 0 +Sports Memorabilia, -17, 0 +Aged Cheese, -25, 50 +Coffee Table Book, -22, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Backstage passes to a concert, -22, 0 +Baked Chocolate Cake, -24, 0 -------- day 28 -------- name, sellIn, quality -+5 Dexterity Vest, -18, 0 -Aged Brie, -26, 50 -Elixir of the Mongoose, -23, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Backstage passes to a TAFKAL80ETC concert, -23, 0 -Conjured Mana Cake, -25, 0 +Sports Memorabilia, -18, 0 +Aged Cheese, -26, 50 +Coffee Table Book, -23, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Backstage passes to a concert, -23, 0 +Baked Chocolate Cake, -25, 0 -------- day 29 -------- name, sellIn, quality -+5 Dexterity Vest, -19, 0 -Aged Brie, -27, 50 -Elixir of the Mongoose, -24, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Backstage passes to a TAFKAL80ETC concert, -24, 0 -Conjured Mana Cake, -26, 0 +Sports Memorabilia, -19, 0 +Aged Cheese, -27, 50 +Coffee Table Book, -24, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Backstage passes to a concert, -24, 0 +Baked Chocolate Cake, -26, 0 -------- day 30 -------- name, sellIn, quality -+5 Dexterity Vest, -20, 0 -Aged Brie, -28, 50 -Elixir of the Mongoose, -25, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Backstage passes to a TAFKAL80ETC concert, -25, 0 -Conjured Mana Cake, -27, 0 +Sports Memorabilia, -20, 0 +Aged Cheese, -28, 50 +Coffee Table Book, -25, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Backstage passes to a concert, -25, 0 +Baked Chocolate Cake, -27, 0 diff --git a/plantuml/gilded-rose.puml b/plantuml/gilded-rose.puml index 1d36cb1d..06aff0a9 100644 --- a/plantuml/gilded-rose.puml +++ b/plantuml/gilded-rose.puml @@ -8,9 +8,9 @@ note left An item has a name, a sell in value and a quality value end note -if (not "Aged Brie" and not "Backstage passes to a TAFKAL80ETC concert") then (yes) +if (not "Aged Cheese" and not "Backstage passes to a concert") then (yes) if (quality > 0) then (yes) - if (not "Sulfuras, Hand of Ragnaros") then (yes) + if (not "Fine Italian Silk") then (yes) :lower quality with 1; else (no) endif @@ -19,7 +19,7 @@ if (not "Aged Brie" and not "Backstage passes to a TAFKAL80ETC concert") then (y else (no) if (quality < 50) then (yes) :increase quality with 1; - if ("Backstage passes to a TAFKAL80ETC concert") then (yes) + if ("Backstage passes to a concert") then (yes) if (sell in < 11) then (yes) if (quality < 50) then (yes) :increase quality with 1; @@ -40,16 +40,16 @@ else (no) endif endif -if (not "Sulfuras, Hand of Ragnaros") then (yes) +if (not "Fine Italian Silk") then (yes) :lower sell in with 1; else (no) endif if (sell in < 0) then (yes) - if (not "Aged Brie") then (yes) - if (not "Backstage passes to a TAFKAL80ETC concert") then (yes) + if (not "Aged Cheese") then (yes) + if (not "Backstage passes to a concert") then (yes) if (quality > 0) then (yes) - if (not "Sulfuras, Hand of Ragnaros") then (yes) + if (not "Fine Italian Silk") then (yes) :lower quality with 1; else (no) endif diff --git a/plantuml/history/04_aged-brie.puml b/plantuml/history/04_aged-brie.puml index 7b74e874..334d5a1a 100644 --- a/plantuml/history/04_aged-brie.puml +++ b/plantuml/history/04_aged-brie.puml @@ -4,7 +4,7 @@ skinparam backgroundColor transparent start -if (not "Aged Brie") then (yes) +if (not "Aged Cheese") then (yes) if (quality > 0) then (yes) :lower quality with 1; else (no) @@ -16,7 +16,7 @@ endif :lower sell in with 1; if (sell in < 0) then (yes) - if (not "Aged Brie") then (yes) + if (not "Aged Cheese") then (yes) if (quality > 0) then (yes) :lower quality with 1; else (no) diff --git a/plantuml/history/05_quality-max-50.puml b/plantuml/history/05_quality-max-50.puml index 69cc86d0..236db0b8 100644 --- a/plantuml/history/05_quality-max-50.puml +++ b/plantuml/history/05_quality-max-50.puml @@ -4,7 +4,7 @@ skinparam backgroundColor transparent start -if (not "Aged Brie") then (yes) +if (not "Aged Cheese") then (yes) if (quality > 0) then (yes) :lower quality with 1; else (no) @@ -19,7 +19,7 @@ endif :lower sell in with 1; if (sell in < 0) then (yes) - if (not "Aged Brie") then (yes) + if (not "Aged Cheese") then (yes) if (quality > 0) then (yes) :lower quality with 1; else (no) diff --git a/plantuml/history/06_sulfuras.puml b/plantuml/history/06_sulfuras.puml index 25350c1d..37c8bbd8 100644 --- a/plantuml/history/06_sulfuras.puml +++ b/plantuml/history/06_sulfuras.puml @@ -4,9 +4,9 @@ skinparam backgroundColor transparent start -if (not "Aged Brie") then (yes) +if (not "Aged Cheese") then (yes) if (quality > 0) then (yes) - if (not "Sulfuras, Hand of Ragnaros") then (yes) + if (not "Fine Italian Silk") then (yes) :lower quality with 1; else (no) endif @@ -19,15 +19,15 @@ else (no) endif endif -if (not "Sulfuras, Hand of Ragnaros") then (yes) +if (not "Fine Italian Silk") then (yes) :lower sell in with 1; else (no) endif if (sell in < 0) then (yes) - if (not "Aged Brie") then (yes) + if (not "Aged Cheese") then (yes) if (quality > 0) then (yes) - if (not "Sulfuras, Hand of Ragnaros") then (yes) + if (not "Fine Italian Silk") then (yes) :lower quality with 1; else (no) endif diff --git a/plantuml/history/07_backstage-passes.puml b/plantuml/history/07_backstage-passes.puml index 5d6f2fa3..d493cbb0 100644 --- a/plantuml/history/07_backstage-passes.puml +++ b/plantuml/history/07_backstage-passes.puml @@ -4,9 +4,9 @@ skinparam backgroundColor transparent start -if (not "Aged Brie" and not "Backstage passes to a TAFKAL80ETC concert") then (yes) +if (not "Aged Cheese" and not "Backstage passes to a concert") then (yes) if (quality > 0) then (yes) - if (not "Sulfuras, Hand of Ragnaros") then (yes) + if (not "Fine Italian Silk") then (yes) :lower quality with 1; else (no) endif @@ -15,7 +15,7 @@ if (not "Aged Brie" and not "Backstage passes to a TAFKAL80ETC concert") then (y else (no) if (quality < 50) then (yes) :increase quality with 1; - if ("Backstage passes to a TAFKAL80ETC concert") then (yes) + if ("Backstage passes to a concert") then (yes) if (sell in < 11) then (yes) if (quality < 50) then (yes) :increase quality with 1; @@ -36,16 +36,16 @@ else (no) endif endif -if (not "Sulfuras, Hand of Ragnaros") then (yes) +if (not "Fine Italian Silk") then (yes) :lower sell in with 1; else (no) endif if (sell in < 0) then (yes) - if (not "Aged Brie") then (yes) - if (not "Backstage passes to a TAFKAL80ETC concert") then (yes) + if (not "Aged Cheese") then (yes) + if (not "Backstage passes to a concert") then (yes) if (quality > 0) then (yes) - if (not "Sulfuras, Hand of Ragnaros") then (yes) + if (not "Fine Italian Silk") then (yes) :lower quality with 1; else (no) endif diff --git a/plpgsql/README.md b/plpgsql/README.md index 93337289..940537f5 100644 --- a/plpgsql/README.md +++ b/plpgsql/README.md @@ -22,7 +22,7 @@ If you get this message```LINE 1: CREATE OR REPLACE PROCEDURE public.update_qual # Run In shell: - connect to CLI: ```psql -d kata``` -- add item: ```CALL new_item('+5 Dexterity Vest', 10, 20);``` +- add item: ```CALL new_item('Sports Memorabilia', 10, 20);``` - check item state: ```SELECT * FROM item;``` - execute item update: ```CALL update_quality();``` - check item state: ```SELECT * FROM item;``` diff --git a/plpgsql/pgunit/run_tests.sql b/plpgsql/pgunit/run_tests.sql index 3c4e3c68..4f7ed6d6 100644 --- a/plpgsql/pgunit/run_tests.sql +++ b/plpgsql/pgunit/run_tests.sql @@ -40,16 +40,16 @@ DECLARE BEGIN -- given TRUNCATE TABLE item; - CALL new_item('+5 Dexterity Vest', 10, 20); - CALL new_item('Aged Brie', 2, 0); - CALL new_item('Elixir of the Mongoose', 5, 7); - CALL new_item('Sulfuras, Hand of Ragnaros', 0, 80); - CALL new_item('Sulfuras, Hand of Ragnaros', -1, 80); - CALL new_item('Backstage passes to a TAFKAL80ETC concert', 15, 20); - CALL new_item('Backstage passes to a TAFKAL80ETC concert', 10, 49); - CALL new_item('Backstage passes to a TAFKAL80ETC concert', 5, 49); - -- this conjured item does not work properly yet ; - CALL new_item('Conjured Mana Cake', 3, 6); + CALL new_item('Sports Memorabilia', 10, 20); + CALL new_item('Aged Cheese', 2, 0); + CALL new_item('Coffee Table Book', 5, 7); + CALL new_item('Fine Italian Silk', 0, 80); + CALL new_item('Fine Italian Silk', -1, 80); + CALL new_item('Backstage passes to a concert', 15, 20); + CALL new_item('Backstage passes to a concert', 10, 49); + CALL new_item('Backstage passes to a concert', 5, 49); + -- this Baked item does not work properly yet ; + CALL new_item('Baked Chocolate Cake', 3, 6); days := 1; -- when @@ -62,29 +62,29 @@ BEGIN END LOOP; -- then - expected := ARRAY[ + expected := ARRAY[ '-------- day 0 --------', 'name, sellIn, quality', - '+5 Dexterity Vest, 10, 20', - 'Aged Brie, 2, 0', - 'Backstage passes to a TAFKAL80ETC concert, 5, 49', - 'Backstage passes to a TAFKAL80ETC concert, 10, 49', - 'Backstage passes to a TAFKAL80ETC concert, 15, 20', - 'Conjured Mana Cake, 3, 6', - 'Elixir of the Mongoose, 5, 7', - 'Sulfuras, Hand of Ragnaros, -1, 80', - 'Sulfuras, Hand of Ragnaros, 0, 80', + 'Sports Memorabilia, 10, 20', + 'Aged Cheese, 2, 0', + 'Backstage passes to a concert, 5, 49', + 'Backstage passes to a concert, 10, 49', + 'Backstage passes to a concert, 15, 20', + 'Baked Chocolate Cake, 3, 6', + 'Coffee Table Book, 5, 7', + 'Fine Italian Silk, -1, 80', + 'Fine Italian Silk, 0, 80', '-------- day 1 --------', 'name, sellIn, quality', - '+5 Dexterity Vest, 9, 19', - 'Aged Brie, 1, 1', - 'Backstage passes to a TAFKAL80ETC concert, 4, 50', - 'Backstage passes to a TAFKAL80ETC concert, 9, 50', - 'Backstage passes to a TAFKAL80ETC concert, 14, 21', - 'Conjured Mana Cake, 2, 5', - 'Elixir of the Mongoose, 4, 6', - 'Sulfuras, Hand of Ragnaros, -1, 80', - 'Sulfuras, Hand of Ragnaros, 0, 80' + 'Sports Memorabilia, 9, 19', + 'Aged Cheese, 1, 1', + 'Backstage passes to a concert, 4, 50', + 'Backstage passes to a concert, 9, 50', + 'Backstage passes to a concert, 14, 21', + 'Baked Chocolate Cake, 2, 5', + 'Coffee Table Book, 4, 6', + 'Fine Italian Silk, -1, 80', + 'Fine Italian Silk, 0, 80' ]; perform test_assertEquals_golden_master(expected, result); @@ -92,4 +92,4 @@ END; $$ LANGUAGE plpgsql; -SELECT * FROM test_run_all(); \ No newline at end of file +SELECT * FROM test_run_all(); diff --git a/plpgsql/src/update_quality.sql b/plpgsql/src/update_quality.sql index e19d6863..f0e4cab0 100644 --- a/plpgsql/src/update_quality.sql +++ b/plpgsql/src/update_quality.sql @@ -18,16 +18,16 @@ BEGIN l_sell_in := l_item.sell_in; l_quality := l_item.quality; - IF l_name <> 'Aged Brie' AND l_name <> 'Backstage passes to a TAFKAL80ETC concert' THEN + IF l_name <> 'Aged Cheese' AND l_name <> 'Backstage passes to a concert' THEN IF l_quality > 0 THEN - IF l_name <> 'Sulfuras, Hand of Ragnaros' THEN + IF l_name <> 'Fine Italian Silk' THEN l_quality := l_quality - 1; END IF; END IF; ELSE IF (l_quality < 50) THEN l_quality := l_quality + 1; - IF l_name = 'Backstage passes to a TAFKAL80ETC concert' THEN + IF l_name = 'Backstage passes to a concert' THEN IF l_sell_in < 11 THEN IF l_quality < 50 THEN l_quality := l_quality + 1; @@ -42,15 +42,15 @@ BEGIN END IF; END IF; - IF l_name <> 'Sulfuras, Hand of Ragnaros' THEN + IF l_name <> 'Fine Italian Silk' THEN l_sell_in := l_sell_in - 1; END IF; IF l_sell_in < 0 THEN - IF l_name <> 'Aged Brie' THEN - IF l_name <> 'Backstage passes to a TAFKAL80ETC concert' THEN + IF l_name <> 'Aged Cheese' THEN + IF l_name <> 'Backstage passes to a concert' THEN IF l_quality > 0 THEN - IF l_name <> 'Sulfuras, Hand of Ragnaros' THEN + IF l_name <> 'Fine Italian Silk' THEN l_quality := l_quality - 1; END IF; END IF; diff --git a/plsql/texttest.pkb b/plsql/texttest.pkb index cbd2e0e3..b9cfa4d4 100644 --- a/plsql/texttest.pkb +++ b/plsql/texttest.pkb @@ -10,16 +10,16 @@ CREATE OR REPLACE PACKAGE BODY texttest IS BEGIN DELETE FROM ITEM; - new_item('+5 Dexterity Vest', 10, 20); - new_item('Aged Brie', 2, 0); - new_item('Elixir of the Mongoose', 5, 7); - new_item('Sulfuras, Hand of Ragnaros', 0, 80); - new_item('Sulfuras, Hand of Ragnaros', -1, 80); - new_item('Backstage passes to a TAFKAL80ETC concert', 15, 20); - new_item('Backstage passes to a TAFKAL80ETC concert', 10, 49); - new_item('Backstage passes to a TAFKAL80ETC concert', 5, 49); - -- this conjured item does not work properly yet ; - new_item('Conjured Mana Cake', 3, 6); + new_item('Sports Memorabilia', 10, 20); + new_item('Aged Cheese', 2, 0); + new_item('Coffee Table Book', 5, 7); + new_item('Fine Italian Silk', 0, 80); + new_item('Fine Italian Silk', -1, 80); + new_item('Backstage passes to a concert', 15, 20); + new_item('Backstage passes to a concert', 10, 49); + new_item('Backstage passes to a concert', 5, 49); + -- this Baked item does not work properly yet ; + new_item('Baked Chocolate Cake', 3, 6); END setup; PROCEDURE main_test IS @@ -36,25 +36,25 @@ CREATE OR REPLACE PACKAGE BODY texttest IS put_line(v_expected, 'OMGHAI!'); put_line(v_expected, '-------- day 0 --------'); put_line(v_expected, 'name, sellIn, quality'); - put_line(v_expected, '+5 Dexterity Vest, 10, 20' || co_lf || 'Aged Brie, 2, 0'); - put_line(v_expected, 'Elixir of the Mongoose, 5, 7'); - put_line(v_expected, 'Sulfuras, Hand of Ragnaros, 0, 80'); - put_line(v_expected, 'Sulfuras, Hand of Ragnaros, -1, 80'); - put_line(v_expected, 'Backstage passes to a TAFKAL80ETC concert, 15, 20'); - put_line(v_expected, 'Backstage passes to a TAFKAL80ETC concert, 10, 49'); - put_line(v_expected, 'Backstage passes to a TAFKAL80ETC concert, 5, 49'); - put_line(v_expected, 'Conjured Mana Cake, 3, 6'); + put_line(v_expected, 'Sports Memorabilia, 10, 20' || co_lf || 'Aged Cheese, 2, 0'); + put_line(v_expected, 'Coffee Table Book, 5, 7'); + put_line(v_expected, 'Fine Italian Silk, 0, 80'); + put_line(v_expected, 'Fine Italian Silk, -1, 80'); + put_line(v_expected, 'Backstage passes to a concert, 15, 20'); + put_line(v_expected, 'Backstage passes to a concert, 10, 49'); + put_line(v_expected, 'Backstage passes to a concert, 5, 49'); + put_line(v_expected, 'Baked Chocolate Cake, 3, 6'); put_line(v_expected, '-------- day 1 --------'); put_line(v_expected, 'name, sellIn, quality'); - put_line(v_expected, '+5 Dexterity Vest, 9, 19'); - put_line(v_expected, 'Aged Brie, 1, 1'); - put_line(v_expected, 'Elixir of the Mongoose, 4, 6'); - put_line(v_expected, 'Sulfuras, Hand of Ragnaros, 0, 80'); - put_line(v_expected, 'Sulfuras, Hand of Ragnaros, -1, 80'); - put_line(v_expected, 'Backstage passes to a TAFKAL80ETC concert, 14, 21'); - put_line(v_expected, 'Backstage passes to a TAFKAL80ETC concert, 9, 50'); - put_line(v_expected, 'Backstage passes to a TAFKAL80ETC concert, 4, 50'); - put_line(v_expected, 'Conjured Mana Cake, 2, 5'); + put_line(v_expected, 'Sports Memorabilia, 9, 19'); + put_line(v_expected, 'Aged Cheese, 1, 1'); + put_line(v_expected, 'Coffee Table Book, 4, 6'); + put_line(v_expected, 'Fine Italian Silk, 0, 80'); + put_line(v_expected, 'Fine Italian Silk, -1, 80'); + put_line(v_expected, 'Backstage passes to a concert, 14, 21'); + put_line(v_expected, 'Backstage passes to a concert, 9, 50'); + put_line(v_expected, 'Backstage passes to a concert, 4, 50'); + put_line(v_expected, 'Baked Chocolate Cake, 2, 5'); put_line(v_result, 'OMGHAI!'); l_days := 2; @@ -75,4 +75,4 @@ CREATE OR REPLACE PACKAGE BODY texttest IS ut.expect(v_result).to_equal(v_expected); END; END texttest; -/ \ No newline at end of file +/ diff --git a/plsql/update_quality.sql b/plsql/update_quality.sql index 372b6bdb..2eaa8419 100644 --- a/plsql/update_quality.sql +++ b/plsql/update_quality.sql @@ -13,16 +13,16 @@ BEGIN l_sell_in := l_item.sell_in; l_quality := l_item.quality; - IF l_name <> 'Aged Brie' AND l_name <> 'Backstage passes to a TAFKAL80ETC concert' THEN + IF l_name <> 'Aged Cheese' AND l_name <> 'Backstage passes to a concert' THEN IF l_quality > 0 THEN - IF l_name <> 'Sulfuras, Hand of Ragnaros' THEN + IF l_name <> 'Fine Italian Silk' THEN l_quality := l_quality - 1; END IF; END IF; ELSE IF (l_quality < 50) THEN l_quality := l_quality + 1; - IF l_name = 'Backstage passes to a TAFKAL80ETC concert' THEN + IF l_name = 'Backstage passes to a concert' THEN IF l_sell_in < 11 THEN IF l_quality < 50 THEN l_quality := l_quality + 1; @@ -37,15 +37,15 @@ BEGIN END IF; END IF; - IF l_name <> 'Sulfuras, Hand of Ragnaros' THEN + IF l_name <> 'Fine Italian Silk' THEN l_sell_in := l_sell_in - 1; END IF; IF l_sell_in < 0 THEN - IF l_name <> 'Aged Brie' THEN - IF l_name <> 'Backstage passes to a TAFKAL80ETC concert' THEN + IF l_name <> 'Aged Cheese' THEN + IF l_name <> 'Backstage passes to a concert' THEN IF l_quality > 0 THEN - IF l_name <> 'Sulfuras, Hand of Ragnaros' THEN + IF l_name <> 'Fine Italian Silk' THEN l_quality := l_quality - 1; END IF; END IF; diff --git a/python/gilded_rose.py b/python/gilded_rose.py index 4f21ea64..9fd0254b 100755 --- a/python/gilded_rose.py +++ b/python/gilded_rose.py @@ -7,27 +7,27 @@ class GildedRose(object): def update_quality(self): for item in self.items: - if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert": + if item.name != "Aged Cheese" and item.name != "Backstage passes to a concert": if item.quality > 0: - if item.name != "Sulfuras, Hand of Ragnaros": + if item.name != "Fine Italian Silk": item.quality = item.quality - 1 else: if item.quality < 50: item.quality = item.quality + 1 - if item.name == "Backstage passes to a TAFKAL80ETC concert": + if item.name == "Backstage passes to a concert": if item.sell_in < 11: if item.quality < 50: item.quality = item.quality + 1 if item.sell_in < 6: if item.quality < 50: item.quality = item.quality + 1 - if item.name != "Sulfuras, Hand of Ragnaros": + if item.name != "Fine Italian Silk": item.sell_in = item.sell_in - 1 if item.sell_in < 0: - if item.name != "Aged Brie": - if item.name != "Backstage passes to a TAFKAL80ETC concert": + if item.name != "Aged Cheese": + if item.name != "Backstage passes to a concert": if item.quality > 0: - if item.name != "Sulfuras, Hand of Ragnaros": + if item.name != "Fine Italian Silk": item.quality = item.quality - 1 else: item.quality = item.quality - item.quality diff --git a/python/texttest_fixture.py b/python/texttest_fixture.py index 86af5ef7..60e62fd3 100644 --- a/python/texttest_fixture.py +++ b/python/texttest_fixture.py @@ -6,15 +6,15 @@ from gilded_rose import * if __name__ == "__main__": print ("OMGHAI!") items = [ - Item(name="+5 Dexterity Vest", sell_in=10, quality=20), - Item(name="Aged Brie", sell_in=2, quality=0), - Item(name="Elixir of the Mongoose", sell_in=5, quality=7), - Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80), - Item(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80), - Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20), - Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49), - Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=49), - Item(name="Conjured Mana Cake", sell_in=3, quality=6), # <-- :O + Item(name="Sports Memorabilia", sell_in=10, quality=20), + Item(name="Aged Cheese", sell_in=2, quality=0), + Item(name="Coffee Table Book", sell_in=5, quality=7), + Item(name="Fine Italian Silk", sell_in=0, quality=80), + Item(name="Fine Italian Silk", sell_in=-1, quality=80), + Item(name="Backstage passes to a concert", sell_in=15, quality=20), + Item(name="Backstage passes to a concert", sell_in=10, quality=49), + Item(name="Backstage passes to a concert", sell_in=5, quality=49), + Item(name="Baked Chocolate Cake", sell_in=3, quality=6), # <-- :O ] days = 2 diff --git a/ruby/gilded_rose.rb b/ruby/gilded_rose.rb index e177a497..49dca982 100644 --- a/ruby/gilded_rose.rb +++ b/ruby/gilded_rose.rb @@ -6,16 +6,16 @@ class GildedRose def update_quality() @items.each do |item| - if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert" + if item.name != "Aged Cheese" and item.name != "Backstage passes to a concert" if item.quality > 0 - if item.name != "Sulfuras, Hand of Ragnaros" + if item.name != "Fine Italian Silk" item.quality = item.quality - 1 end end else if item.quality < 50 item.quality = item.quality + 1 - if item.name == "Backstage passes to a TAFKAL80ETC concert" + if item.name == "Backstage passes to a concert" if item.sell_in < 11 if item.quality < 50 item.quality = item.quality + 1 @@ -29,14 +29,14 @@ class GildedRose end end end - if item.name != "Sulfuras, Hand of Ragnaros" + if item.name != "Fine Italian Silk" item.sell_in = item.sell_in - 1 end if item.sell_in < 0 - if item.name != "Aged Brie" - if item.name != "Backstage passes to a TAFKAL80ETC concert" + if item.name != "Aged Cheese" + if item.name != "Backstage passes to a concert" if item.quality > 0 - if item.name != "Sulfuras, Hand of Ragnaros" + if item.name != "Fine Italian Silk" item.quality = item.quality - 1 end end diff --git a/ruby/texttest_fixture.rb b/ruby/texttest_fixture.rb index ad76aacf..ee597fe6 100644 --- a/ruby/texttest_fixture.rb +++ b/ruby/texttest_fixture.rb @@ -4,16 +4,16 @@ require File.join(File.dirname(__FILE__), 'gilded_rose') puts "OMGHAI!" items = [ - Item.new(name="+5 Dexterity Vest", sell_in=10, quality=20), - Item.new(name="Aged Brie", sell_in=2, quality=0), - Item.new(name="Elixir of the Mongoose", sell_in=5, quality=7), - Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80), - Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80), - Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20), - Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49), - Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=49), - # This Conjured item does not work properly yet - Item.new(name="Conjured Mana Cake", sell_in=3, quality=6), # <-- :O + Item.new(name="Sports Memorabilia", sell_in=10, quality=20), + Item.new(name="Aged Cheese", sell_in=2, quality=0), + Item.new(name="Coffee Table Book", sell_in=5, quality=7), + Item.new(name="Fine Italian Silk", sell_in=0, quality=80), + Item.new(name="Fine Italian Silk", sell_in=-1, quality=80), + Item.new(name="Backstage passes to a concert", sell_in=15, quality=20), + Item.new(name="Backstage passes to a concert", sell_in=10, quality=49), + Item.new(name="Backstage passes to a concert", sell_in=5, quality=49), + # This Baked item does not work properly yet + Item.new(name="Baked Chocolate Cake", sell_in=3, quality=6), # <-- :O ] days = 2 diff --git a/rust/src/gildedrose.rs b/rust/src/gildedrose.rs index 9e387756..8f53989d 100644 --- a/rust/src/gildedrose.rs +++ b/rust/src/gildedrose.rs @@ -32,10 +32,10 @@ impl GildedRose { pub fn update_quality(&mut self) { for item in &mut self.items { - if item.name != "Aged Brie" && item.name != "Backstage passes to a TAFKAL80ETC concert" + if item.name != "Aged Cheese" && item.name != "Backstage passes to a concert" { if item.quality > 0 { - if item.name != "Sulfuras, Hand of Ragnaros" { + if item.name != "Fine Italian Silk" { item.quality = item.quality - 1; } } @@ -43,7 +43,7 @@ impl GildedRose { if item.quality < 50 { item.quality = item.quality + 1; - if item.name == "Backstage passes to a TAFKAL80ETC concert" { + if item.name == "Backstage passes to a concert" { if item.sell_in < 11 { if item.quality < 50 { item.quality = item.quality + 1; @@ -59,15 +59,15 @@ impl GildedRose { } } - if item.name != "Sulfuras, Hand of Ragnaros" { + if item.name != "Fine Italian Silk" { item.sell_in = item.sell_in - 1; } if item.sell_in < 0 { - if item.name != "Aged Brie" { - if item.name != "Backstage passes to a TAFKAL80ETC concert" { + if item.name != "Aged Cheese" { + if item.name != "Backstage passes to a concert" { if item.quality > 0 { - if item.name != "Sulfuras, Hand of Ragnaros" { + if item.name != "Fine Italian Silk" { item.quality = item.quality - 1; } } diff --git a/rust/src/main.rs b/rust/src/main.rs index 3a552a81..b54944c1 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -4,16 +4,16 @@ use gildedrose::{GildedRose, Item}; fn main() { let items = vec![ - Item::new("+5 Dexterity Vest", 10, 20), - Item::new("Aged Brie", 2, 0), - Item::new("Elixir of the Mongoose", 5, 7), - Item::new("Sulfuras, Hand of Ragnaros", 0, 80), - Item::new("Sulfuras, Hand of Ragnaros", -1, 80), - Item::new("Backstage passes to a TAFKAL80ETC concert", 15, 20), - Item::new("Backstage passes to a TAFKAL80ETC concert", 10, 49), - Item::new("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - Item::new("Conjured Mana Cake", 3, 6), + Item::new("Sports Memorabilia", 10, 20), + Item::new("Aged Cheese", 2, 0), + Item::new("Coffee Table Book", 5, 7), + Item::new("Fine Italian Silk", 0, 80), + Item::new("Fine Italian Silk", -1, 80), + Item::new("Backstage passes to a concert", 15, 20), + Item::new("Backstage passes to a concert", 10, 49), + Item::new("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + Item::new("Baked Chocolate Cake", 3, 6), ]; let mut rose = GildedRose::new(items); diff --git a/scala/src/main/scala/com/gildedrose/GildedRose.scala b/scala/src/main/scala/com/gildedrose/GildedRose.scala index 9f9fdd2b..c0917cac 100644 --- a/scala/src/main/scala/com/gildedrose/GildedRose.scala +++ b/scala/src/main/scala/com/gildedrose/GildedRose.scala @@ -5,10 +5,10 @@ class GildedRose(val items: Array[Item]) { def updateQuality() { for (i <- 0 until items.length) { - if (!items(i).name.equals("Aged Brie") - && !items(i).name.equals("Backstage passes to a TAFKAL80ETC concert")) { + if (!items(i).name.equals("Aged Cheese") + && !items(i).name.equals("Backstage passes to a concert")) { if (items(i).quality > 0) { - if (!items(i).name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items(i).name.equals("Fine Italian Silk")) { items(i).quality = items(i).quality - 1 } } @@ -16,7 +16,7 @@ class GildedRose(val items: Array[Item]) { 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).name.equals("Backstage passes to a concert")) { if (items(i).sellIn < 11) { if (items(i).quality < 50) { items(i).quality = items(i).quality + 1 @@ -32,15 +32,15 @@ class GildedRose(val items: Array[Item]) { } } - if (!items(i).name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items(i).name.equals("Fine Italian Silk")) { 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).name.equals("Aged Cheese")) { + if (!items(i).name.equals("Backstage passes to a concert")) { if (items(i).quality > 0) { - if (!items(i).name.equals("Sulfuras, Hand of Ragnaros")) { + if (!items(i).name.equals("Fine Italian Silk")) { items(i).quality = items(i).quality - 1 } } @@ -55,4 +55,4 @@ class GildedRose(val items: Array[Item]) { } } } -} \ No newline at end of file +} diff --git a/scala/src/test/scala/com/gildedrose/TexttestFixture.scala b/scala/src/test/scala/com/gildedrose/TexttestFixture.scala index 1d00808c..5ce4776a 100644 --- a/scala/src/test/scala/com/gildedrose/TexttestFixture.scala +++ b/scala/src/test/scala/com/gildedrose/TexttestFixture.scala @@ -3,16 +3,16 @@ package com.gildedrose object TexttestFixture { def main(args: Array[String]): Unit = { val items = Array[Item]( - new Item("+5 Dexterity Vest", 10, 20), - new Item("Aged Brie", 2, 0), - new Item("Elixir of the Mongoose", 5, 7), - new Item("Sulfuras, Hand of Ragnaros", 0, 80), - new Item("Sulfuras, Hand of Ragnaros", -1, 80), - new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), - new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), - // this conjured item does not work properly yet - new Item("Conjured Mana Cake", 3, 6) + new Item("Sports Memorabilia", 10, 20), + new Item("Aged Cheese", 2, 0), + new Item("Coffee Table Book", 5, 7), + new Item("Fine Italian Silk", 0, 80), + new Item("Fine Italian Silk", -1, 80), + new Item("Backstage passes to a concert", 15, 20), + new Item("Backstage passes to a concert", 10, 49), + new Item("Backstage passes to a concert", 5, 49), + // this Baked item does not work properly yet + new Item("Baked Chocolate Cake", 3, 6) ) val app = new GildedRose(items) val days = if (args.length > 0) args(0).toInt + 1 else 2 diff --git a/scheme/gilded-rose.scm b/scheme/gilded-rose.scm index dac984fa..ce8dad8e 100644 --- a/scheme/gilded-rose.scm +++ b/scheme/gilded-rose.scm @@ -16,14 +16,14 @@ (define (update-quality items) (for-each (lambda (item) - (if (and (not (string=? (item-name item) "Aged Brie")) - (not (string=? (item-name item) "Backstage passes to a TAFKAL80ETC concert"))) + (if (and (not (string=? (item-name item) "Aged Cheese")) + (not (string=? (item-name item) "Backstage passes to a concert"))) (if (> (item-quality item) 0) - (if (not (string=? (item-name item) "Sulfuras, Hand of Ragnaros")) + (if (not (string=? (item-name item) "Fine Italian Silk")) (item-quality-set! item (- (item-quality item) 1)))) (cond ((< (item-quality item) 50) (item-quality-set! item (+ (item-quality item) 1)) - (if (string=? (item-name item) "Backstage passes to a TAFKAL80ETC concert") + (if (string=? (item-name item) "Backstage passes to a concert") (if (< (item-sell-in item) 11) (cond ((< (item-quality item) 50) (item-quality-set! item (+ (item-quality item) 1)) @@ -31,14 +31,14 @@ (if (< (item-quality item) 50) (item-quality-set! item (+ (item-quality item) 1))))))))))) - (if (not (string=? (item-name item) "Sulfuras, Hand of Ragnaros")) + (if (not (string=? (item-name item) "Fine Italian Silk")) (item-sell-in-set! item (- (item-sell-in item) 1))) (if (< (item-sell-in item) 0) - (if (not (string=? (item-name item) "Aged Brie")) - (if (not (string=? (item-name item) "Backstage passes to a TAFKAL80ETC concert")) + (if (not (string=? (item-name item) "Aged Cheese")) + (if (not (string=? (item-name item) "Backstage passes to a concert")) (if (> (item-quality item) 0) - (if (not (string=? (item-name item) "Sulfuras, Hand of Ragnaros")) + (if (not (string=? (item-name item) "Fine Italian Silk")) (item-quality-set! item (- (item-quality item) 1)))) (item-quality-set! item (- (item-quality item) (item-quality item)))) (if (< (item-quality item) 50) diff --git a/scheme/texttest-fixture.scm b/scheme/texttest-fixture.scm index ee15981e..12bdabce 100644 --- a/scheme/texttest-fixture.scm +++ b/scheme/texttest-fixture.scm @@ -3,16 +3,16 @@ (display "OMGHAI!") (newline) -(let ((items (list (make-item "+5 Dexterity Vest" 10 20) - (make-item "Aged Brie" 2 0) - (make-item "Elixir of the Mongoose" 5 7) - (make-item "Sulfuras, Hand of Ragnaros" 0 80) - (make-item "Sulfuras, Hand of Ragnaros" -1 80) - (make-item "Backstage passes to a TAFKAL80ETC concert" 15 20) - (make-item "Backstage passes to a TAFKAL80ETC concert" 10 49) - (make-item "Backstage passes to a TAFKAL80ETC concert" 5 49) - ;; this conjured item does not work properly yet - (make-item "Conjured Mana Cake" 3 6))) +(let ((items (list (make-item "Sports Memorabilia" 10 20) + (make-item "Aged Cheese" 2 0) + (make-item "Coffee Table Book" 5 7) + (make-item "Fine Italian Silk" 0 80) + (make-item "Fine Italian Silk" -1 80) + (make-item "Backstage passes to a concert" 15 20) + (make-item "Backstage passes to a concert" 10 49) + (make-item "Backstage passes to a concert" 5 49) + ;; this Baked item does not work properly yet + (make-item "Baked Chocolate Cake" 3 6))) (days 2)) (define (loop day) diff --git a/sql/code/update_quality.sql b/sql/code/update_quality.sql index 9da22bd5..7930a375 100644 --- a/sql/code/update_quality.sql +++ b/sql/code/update_quality.sql @@ -2,18 +2,18 @@ UPDATE item SET quality = quality - 1 WHERE 1=1 - AND ( name <> 'Aged Brie' AND name <> 'Backstage passes to a TAFKAL80ETC concert') + AND ( name <> 'Aged Cheese' AND name <> 'Backstage passes to a concert') AND quality > 0 - AND name <> 'Sulfuras, Hand of Ragnaros' + AND name <> 'Fine Italian Silk' ; UPDATE item SET quality = quality + 1 WHERE 1=1 - AND NOT ( name <> 'Aged Brie' AND name <> 'Backstage passes to a TAFKAL80ETC concert') + AND NOT ( name <> 'Aged Cheese' AND name <> 'Backstage passes to a concert') AND quality < 50 - AND name = 'Backstage passes to a TAFKAL80ETC concert' + AND name = 'Backstage passes to a concert' AND sellIn < 11 AND quality < 50 ; @@ -22,9 +22,9 @@ UPDATE item SET quality = quality + 1 WHERE 1=1 - AND NOT ( name <> 'Aged Brie' AND name <> 'Backstage passes to a TAFKAL80ETC concert') + AND NOT ( name <> 'Aged Cheese' AND name <> 'Backstage passes to a concert') AND quality < 50 - AND name = 'Backstage passes to a TAFKAL80ETC concert' + AND name = 'Backstage passes to a concert' AND sellIn < 6 AND quality < 50 ; @@ -33,7 +33,7 @@ UPDATE item SET sellIn = sellIn - 1 WHERE 1=1 - AND name <> 'Sulfuras, Hand of Ragnaros' + AND name <> 'Fine Italian Silk' ; UPDATE item @@ -41,10 +41,10 @@ SET quality = quality - 1 WHERE 1=1 AND sellIn < 0 - AND name <> 'Aged Brie' - AND name <> 'Backstage passes to a TAFKAL80ETC concert' + AND name <> 'Aged Cheese' + AND name <> 'Backstage passes to a concert' AND quality > 0 - AND name <> 'Sulfuras, Hand of Ragnaros' + AND name <> 'Fine Italian Silk' ; UPDATE item @@ -52,8 +52,8 @@ SET quality = quality - quality WHERE 1=1 AND sellIn < 0 - AND name <> 'Aged Brie' - AND NOT (name <> 'Backstage passes to a TAFKAL80ETC concert') + AND name <> 'Aged Cheese' + AND NOT (name <> 'Backstage passes to a concert') ; UPDATE item @@ -61,9 +61,9 @@ SET quality = quality + 1 WHERE 1=1 AND sellIn < 0 - AND NOT (name <> 'Aged Brie') + AND NOT (name <> 'Aged Cheese') AND quality < 50 - AND name <> 'Sulfuras, Hand of Ragnaros' + AND name <> 'Fine Italian Silk' ; -COMMIT; \ No newline at end of file +COMMIT; diff --git a/sql/test/data/load.sql b/sql/test/data/load.sql index 7a142212..ef0856a3 100644 --- a/sql/test/data/load.sql +++ b/sql/test/data/load.sql @@ -1,15 +1,15 @@ DELETE FROM item; -INSERT INTO item (name, sellIn, quality) VALUES ('+5 Dexterity Vest', 10, 20); -INSERT INTO item (name, sellIn, quality) VALUES ('Aged Brie', 2, 0); -INSERT INTO item (name, sellIn, quality) VALUES ('Elixir of the Mongoose', 5, 7); -INSERT INTO item (name, sellIn, quality) VALUES ('Sulfuras, Hand of Ragnaros', 0, 80); -INSERT INTO item (name, sellIn, quality) VALUES ('Sulfuras, Hand of Ragnaros', -1, 80); -INSERT INTO item (name, sellIn, quality) VALUES ('Backstage passes to a TAFKAL80ETC concert', 15, 20); -INSERT INTO item (name, sellIn, quality) VALUES ('Backstage passes to a TAFKAL80ETC concert', 10, 49); -INSERT INTO item (name, sellIn, quality) VALUES ('Backstage passes to a TAFKAL80ETC concert', 5, 49); +INSERT INTO item (name, sellIn, quality) VALUES ('Sports Memorabilia', 10, 20); +INSERT INTO item (name, sellIn, quality) VALUES ('Aged Cheese', 2, 0); +INSERT INTO item (name, sellIn, quality) VALUES ('Coffee Table Book', 5, 7); +INSERT INTO item (name, sellIn, quality) VALUES ('Fine Italian Silk', 0, 80); +INSERT INTO item (name, sellIn, quality) VALUES ('Fine Italian Silk', -1, 80); +INSERT INTO item (name, sellIn, quality) VALUES ('Backstage passes to a concert', 15, 20); +INSERT INTO item (name, sellIn, quality) VALUES ('Backstage passes to a concert', 10, 49); +INSERT INTO item (name, sellIn, quality) VALUES ('Backstage passes to a concert', 5, 49); --- this conjured item does not work properly yet -INSERT INTO item (name, sellIn, quality) VALUES ('Conjured Mana Cake', 3, 6); +-- this Baked item does not work properly yet +INSERT INTO item (name, sellIn, quality) VALUES ('Baked Chocolate Cake', 3, 6); COMMIT; diff --git a/swift/Sources/GildedRose/GildedRose.swift b/swift/Sources/GildedRose/GildedRose.swift index ea0aa861..05cfbf94 100644 --- a/swift/Sources/GildedRose/GildedRose.swift +++ b/swift/Sources/GildedRose/GildedRose.swift @@ -7,9 +7,9 @@ public class GildedRose { public func updateQuality() { for i in 0 ..< items.count { - if items[i].name != "Aged Brie", items[i].name != "Backstage passes to a TAFKAL80ETC concert" { + if items[i].name != "Aged Cheese", items[i].name != "Backstage passes to a concert" { if items[i].quality > 0 { - if items[i].name != "Sulfuras, Hand of Ragnaros" { + if items[i].name != "Fine Italian Silk" { items[i].quality = items[i].quality - 1 } } @@ -17,7 +17,7 @@ public class GildedRose { 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].name == "Backstage passes to a concert" { if items[i].sellIn < 11 { if items[i].quality < 50 { items[i].quality = items[i].quality + 1 @@ -33,15 +33,15 @@ public class GildedRose { } } - if items[i].name != "Sulfuras, Hand of Ragnaros" { + if items[i].name != "Fine Italian Silk" { 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].name != "Aged Cheese" { + if items[i].name != "Backstage passes to a concert" { if items[i].quality > 0 { - if items[i].name != "Sulfuras, Hand of Ragnaros" { + if items[i].name != "Fine Italian Silk" { items[i].quality = items[i].quality - 1 } } diff --git a/swift/Sources/GildedRoseApp/main.swift b/swift/Sources/GildedRoseApp/main.swift index edd7dc13..8cc6c3a0 100644 --- a/swift/Sources/GildedRoseApp/main.swift +++ b/swift/Sources/GildedRoseApp/main.swift @@ -1,16 +1,16 @@ import GildedRose let items = [ - Item(name: "+5 Dexterity Vest", sellIn: 10, quality: 20), - Item(name: "Aged Brie", sellIn: 2, quality: 0), - Item(name: "Elixir of the Mongoose", sellIn: 5, quality: 7), - Item(name: "Sulfuras, Hand of Ragnaros", sellIn: 0, quality: 80), - Item(name: "Sulfuras, Hand of Ragnaros", sellIn: -1, quality: 80), - Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 15, quality: 20), - Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 10, quality: 49), - Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 5, quality: 49), - // this conjured item does not work properly yet - Item(name: "Conjured Mana Cake", sellIn: 3, quality: 6), + Item(name: "Sports Memorabilia", sellIn: 10, quality: 20), + Item(name: "Aged Cheese", sellIn: 2, quality: 0), + Item(name: "Coffee Table Book", sellIn: 5, quality: 7), + Item(name: "Fine Italian Silk", sellIn: 0, quality: 80), + Item(name: "Fine Italian Silk", sellIn: -1, quality: 80), + Item(name: "Backstage passes to a concert", sellIn: 15, quality: 20), + Item(name: "Backstage passes to a concert", sellIn: 10, quality: 49), + Item(name: "Backstage passes to a concert", sellIn: 5, quality: 49), + // this Baked item does not work properly yet + Item(name: "Baked Chocolate Cake", sellIn: 3, quality: 6), ] let app = GildedRose(items: items) diff --git a/texttests/ThirtyDays/stdout.gr b/texttests/ThirtyDays/stdout.gr index a04e48ac..75ba4b52 100644 --- a/texttests/ThirtyDays/stdout.gr +++ b/texttests/ThirtyDays/stdout.gr @@ -1,373 +1,373 @@ OMGHAI! -------- day 0 -------- name, sellIn, quality -+5 Dexterity Vest, 10, 20 -Aged Brie, 2, 0 -Elixir of the Mongoose, 5, 7 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 15, 20 -Backstage passes to a TAFKAL80ETC concert, 10, 49 -Backstage passes to a TAFKAL80ETC concert, 5, 49 -Conjured Mana Cake, 3, 6 +Sports Memorabilia, 10, 20 +Aged Cheese, 2, 0 +Coffee Table Book, 5, 7 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 15, 20 +Backstage passes to a concert, 10, 49 +Backstage passes to a concert, 5, 49 +Baked Chocolate Cake, 3, 6 -------- day 1 -------- name, sellIn, quality -+5 Dexterity Vest, 9, 19 -Aged Brie, 1, 1 -Elixir of the Mongoose, 4, 6 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 14, 21 -Backstage passes to a TAFKAL80ETC concert, 9, 50 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Conjured Mana Cake, 2, 5 +Sports Memorabilia, 9, 19 +Aged Cheese, 1, 1 +Coffee Table Book, 4, 6 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 14, 21 +Backstage passes to a concert, 9, 50 +Backstage passes to a concert, 4, 50 +Baked Chocolate Cake, 2, 5 -------- day 2 -------- name, sellIn, quality -+5 Dexterity Vest, 8, 18 -Aged Brie, 0, 2 -Elixir of the Mongoose, 3, 5 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 13, 22 -Backstage passes to a TAFKAL80ETC concert, 8, 50 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Conjured Mana Cake, 1, 4 +Sports Memorabilia, 8, 18 +Aged Cheese, 0, 2 +Coffee Table Book, 3, 5 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 13, 22 +Backstage passes to a concert, 8, 50 +Backstage passes to a concert, 3, 50 +Baked Chocolate Cake, 1, 4 -------- day 3 -------- name, sellIn, quality -+5 Dexterity Vest, 7, 17 -Aged Brie, -1, 4 -Elixir of the Mongoose, 2, 4 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 12, 23 -Backstage passes to a TAFKAL80ETC concert, 7, 50 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Conjured Mana Cake, 0, 3 +Sports Memorabilia, 7, 17 +Aged Cheese, -1, 4 +Coffee Table Book, 2, 4 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 12, 23 +Backstage passes to a concert, 7, 50 +Backstage passes to a concert, 2, 50 +Baked Chocolate Cake, 0, 3 -------- day 4 -------- name, sellIn, quality -+5 Dexterity Vest, 6, 16 -Aged Brie, -2, 6 -Elixir of the Mongoose, 1, 3 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 11, 24 -Backstage passes to a TAFKAL80ETC concert, 6, 50 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Conjured Mana Cake, -1, 1 +Sports Memorabilia, 6, 16 +Aged Cheese, -2, 6 +Coffee Table Book, 1, 3 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 11, 24 +Backstage passes to a concert, 6, 50 +Backstage passes to a concert, 1, 50 +Baked Chocolate Cake, -1, 1 -------- day 5 -------- name, sellIn, quality -+5 Dexterity Vest, 5, 15 -Aged Brie, -3, 8 -Elixir of the Mongoose, 0, 2 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 10, 25 -Backstage passes to a TAFKAL80ETC concert, 5, 50 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Conjured Mana Cake, -2, 0 +Sports Memorabilia, 5, 15 +Aged Cheese, -3, 8 +Coffee Table Book, 0, 2 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 10, 25 +Backstage passes to a concert, 5, 50 +Backstage passes to a concert, 0, 50 +Baked Chocolate Cake, -2, 0 -------- day 6 -------- name, sellIn, quality -+5 Dexterity Vest, 4, 14 -Aged Brie, -4, 10 -Elixir of the Mongoose, -1, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 9, 27 -Backstage passes to a TAFKAL80ETC concert, 4, 50 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Conjured Mana Cake, -3, 0 +Sports Memorabilia, 4, 14 +Aged Cheese, -4, 10 +Coffee Table Book, -1, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 9, 27 +Backstage passes to a concert, 4, 50 +Backstage passes to a concert, -1, 0 +Baked Chocolate Cake, -3, 0 -------- day 7 -------- name, sellIn, quality -+5 Dexterity Vest, 3, 13 -Aged Brie, -5, 12 -Elixir of the Mongoose, -2, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 8, 29 -Backstage passes to a TAFKAL80ETC concert, 3, 50 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Conjured Mana Cake, -4, 0 +Sports Memorabilia, 3, 13 +Aged Cheese, -5, 12 +Coffee Table Book, -2, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 8, 29 +Backstage passes to a concert, 3, 50 +Backstage passes to a concert, -2, 0 +Baked Chocolate Cake, -4, 0 -------- day 8 -------- name, sellIn, quality -+5 Dexterity Vest, 2, 12 -Aged Brie, -6, 14 -Elixir of the Mongoose, -3, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 7, 31 -Backstage passes to a TAFKAL80ETC concert, 2, 50 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Conjured Mana Cake, -5, 0 +Sports Memorabilia, 2, 12 +Aged Cheese, -6, 14 +Coffee Table Book, -3, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 7, 31 +Backstage passes to a concert, 2, 50 +Backstage passes to a concert, -3, 0 +Baked Chocolate Cake, -5, 0 -------- day 9 -------- name, sellIn, quality -+5 Dexterity Vest, 1, 11 -Aged Brie, -7, 16 -Elixir of the Mongoose, -4, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 6, 33 -Backstage passes to a TAFKAL80ETC concert, 1, 50 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Conjured Mana Cake, -6, 0 +Sports Memorabilia, 1, 11 +Aged Cheese, -7, 16 +Coffee Table Book, -4, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 6, 33 +Backstage passes to a concert, 1, 50 +Backstage passes to a concert, -4, 0 +Baked Chocolate Cake, -6, 0 -------- day 10 -------- name, sellIn, quality -+5 Dexterity Vest, 0, 10 -Aged Brie, -8, 18 -Elixir of the Mongoose, -5, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 5, 35 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Conjured Mana Cake, -7, 0 +Sports Memorabilia, 0, 10 +Aged Cheese, -8, 18 +Coffee Table Book, -5, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 5, 35 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Baked Chocolate Cake, -7, 0 -------- day 11 -------- name, sellIn, quality -+5 Dexterity Vest, -1, 8 -Aged Brie, -9, 20 -Elixir of the Mongoose, -6, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 4, 38 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Conjured Mana Cake, -8, 0 +Sports Memorabilia, -1, 8 +Aged Cheese, -9, 20 +Coffee Table Book, -6, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 4, 38 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Baked Chocolate Cake, -8, 0 -------- day 12 -------- name, sellIn, quality -+5 Dexterity Vest, -2, 6 -Aged Brie, -10, 22 -Elixir of the Mongoose, -7, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 3, 41 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Conjured Mana Cake, -9, 0 +Sports Memorabilia, -2, 6 +Aged Cheese, -10, 22 +Coffee Table Book, -7, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 3, 41 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Baked Chocolate Cake, -9, 0 -------- day 13 -------- name, sellIn, quality -+5 Dexterity Vest, -3, 4 -Aged Brie, -11, 24 -Elixir of the Mongoose, -8, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 2, 44 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Conjured Mana Cake, -10, 0 +Sports Memorabilia, -3, 4 +Aged Cheese, -11, 24 +Coffee Table Book, -8, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 2, 44 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Baked Chocolate Cake, -10, 0 -------- day 14 -------- name, sellIn, quality -+5 Dexterity Vest, -4, 2 -Aged Brie, -12, 26 -Elixir of the Mongoose, -9, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 1, 47 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Conjured Mana Cake, -11, 0 +Sports Memorabilia, -4, 2 +Aged Cheese, -12, 26 +Coffee Table Book, -9, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 1, 47 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Baked Chocolate Cake, -11, 0 -------- day 15 -------- name, sellIn, quality -+5 Dexterity Vest, -5, 0 -Aged Brie, -13, 28 -Elixir of the Mongoose, -10, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, 0, 50 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Conjured Mana Cake, -12, 0 +Sports Memorabilia, -5, 0 +Aged Cheese, -13, 28 +Coffee Table Book, -10, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, 0, 50 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Baked Chocolate Cake, -12, 0 -------- day 16 -------- name, sellIn, quality -+5 Dexterity Vest, -6, 0 -Aged Brie, -14, 30 -Elixir of the Mongoose, -11, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -1, 0 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Conjured Mana Cake, -13, 0 +Sports Memorabilia, -6, 0 +Aged Cheese, -14, 30 +Coffee Table Book, -11, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -1, 0 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Baked Chocolate Cake, -13, 0 -------- day 17 -------- name, sellIn, quality -+5 Dexterity Vest, -7, 0 -Aged Brie, -15, 32 -Elixir of the Mongoose, -12, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -2, 0 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Conjured Mana Cake, -14, 0 +Sports Memorabilia, -7, 0 +Aged Cheese, -15, 32 +Coffee Table Book, -12, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -2, 0 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Baked Chocolate Cake, -14, 0 -------- day 18 -------- name, sellIn, quality -+5 Dexterity Vest, -8, 0 -Aged Brie, -16, 34 -Elixir of the Mongoose, -13, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -3, 0 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Conjured Mana Cake, -15, 0 +Sports Memorabilia, -8, 0 +Aged Cheese, -16, 34 +Coffee Table Book, -13, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -3, 0 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Baked Chocolate Cake, -15, 0 -------- day 19 -------- name, sellIn, quality -+5 Dexterity Vest, -9, 0 -Aged Brie, -17, 36 -Elixir of the Mongoose, -14, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -4, 0 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Conjured Mana Cake, -16, 0 +Sports Memorabilia, -9, 0 +Aged Cheese, -17, 36 +Coffee Table Book, -14, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -4, 0 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Baked Chocolate Cake, -16, 0 -------- day 20 -------- name, sellIn, quality -+5 Dexterity Vest, -10, 0 -Aged Brie, -18, 38 -Elixir of the Mongoose, -15, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -5, 0 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Conjured Mana Cake, -17, 0 +Sports Memorabilia, -10, 0 +Aged Cheese, -18, 38 +Coffee Table Book, -15, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -5, 0 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Baked Chocolate Cake, -17, 0 -------- day 21 -------- name, sellIn, quality -+5 Dexterity Vest, -11, 0 -Aged Brie, -19, 40 -Elixir of the Mongoose, -16, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -6, 0 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Conjured Mana Cake, -18, 0 +Sports Memorabilia, -11, 0 +Aged Cheese, -19, 40 +Coffee Table Book, -16, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -6, 0 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Baked Chocolate Cake, -18, 0 -------- day 22 -------- name, sellIn, quality -+5 Dexterity Vest, -12, 0 -Aged Brie, -20, 42 -Elixir of the Mongoose, -17, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -7, 0 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Conjured Mana Cake, -19, 0 +Sports Memorabilia, -12, 0 +Aged Cheese, -20, 42 +Coffee Table Book, -17, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -7, 0 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Baked Chocolate Cake, -19, 0 -------- day 23 -------- name, sellIn, quality -+5 Dexterity Vest, -13, 0 -Aged Brie, -21, 44 -Elixir of the Mongoose, -18, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -8, 0 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Conjured Mana Cake, -20, 0 +Sports Memorabilia, -13, 0 +Aged Cheese, -21, 44 +Coffee Table Book, -18, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -8, 0 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Baked Chocolate Cake, -20, 0 -------- day 24 -------- name, sellIn, quality -+5 Dexterity Vest, -14, 0 -Aged Brie, -22, 46 -Elixir of the Mongoose, -19, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -9, 0 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Conjured Mana Cake, -21, 0 +Sports Memorabilia, -14, 0 +Aged Cheese, -22, 46 +Coffee Table Book, -19, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -9, 0 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Baked Chocolate Cake, -21, 0 -------- day 25 -------- name, sellIn, quality -+5 Dexterity Vest, -15, 0 -Aged Brie, -23, 48 -Elixir of the Mongoose, -20, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -10, 0 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Conjured Mana Cake, -22, 0 +Sports Memorabilia, -15, 0 +Aged Cheese, -23, 48 +Coffee Table Book, -20, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -10, 0 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Baked Chocolate Cake, -22, 0 -------- day 26 -------- name, sellIn, quality -+5 Dexterity Vest, -16, 0 -Aged Brie, -24, 50 -Elixir of the Mongoose, -21, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -11, 0 -Backstage passes to a TAFKAL80ETC concert, -16, 0 -Backstage passes to a TAFKAL80ETC concert, -21, 0 -Conjured Mana Cake, -23, 0 +Sports Memorabilia, -16, 0 +Aged Cheese, -24, 50 +Coffee Table Book, -21, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -11, 0 +Backstage passes to a concert, -16, 0 +Backstage passes to a concert, -21, 0 +Baked Chocolate Cake, -23, 0 -------- day 27 -------- name, sellIn, quality -+5 Dexterity Vest, -17, 0 -Aged Brie, -25, 50 -Elixir of the Mongoose, -22, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -12, 0 -Backstage passes to a TAFKAL80ETC concert, -17, 0 -Backstage passes to a TAFKAL80ETC concert, -22, 0 -Conjured Mana Cake, -24, 0 +Sports Memorabilia, -17, 0 +Aged Cheese, -25, 50 +Coffee Table Book, -22, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -12, 0 +Backstage passes to a concert, -17, 0 +Backstage passes to a concert, -22, 0 +Baked Chocolate Cake, -24, 0 -------- day 28 -------- name, sellIn, quality -+5 Dexterity Vest, -18, 0 -Aged Brie, -26, 50 -Elixir of the Mongoose, -23, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -13, 0 -Backstage passes to a TAFKAL80ETC concert, -18, 0 -Backstage passes to a TAFKAL80ETC concert, -23, 0 -Conjured Mana Cake, -25, 0 +Sports Memorabilia, -18, 0 +Aged Cheese, -26, 50 +Coffee Table Book, -23, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -13, 0 +Backstage passes to a concert, -18, 0 +Backstage passes to a concert, -23, 0 +Baked Chocolate Cake, -25, 0 -------- day 29 -------- name, sellIn, quality -+5 Dexterity Vest, -19, 0 -Aged Brie, -27, 50 -Elixir of the Mongoose, -24, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -14, 0 -Backstage passes to a TAFKAL80ETC concert, -19, 0 -Backstage passes to a TAFKAL80ETC concert, -24, 0 -Conjured Mana Cake, -26, 0 +Sports Memorabilia, -19, 0 +Aged Cheese, -27, 50 +Coffee Table Book, -24, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -14, 0 +Backstage passes to a concert, -19, 0 +Backstage passes to a concert, -24, 0 +Baked Chocolate Cake, -26, 0 -------- day 30 -------- name, sellIn, quality -+5 Dexterity Vest, -20, 0 -Aged Brie, -28, 50 -Elixir of the Mongoose, -25, 0 -Sulfuras, Hand of Ragnaros, 0, 80 -Sulfuras, Hand of Ragnaros, -1, 80 -Backstage passes to a TAFKAL80ETC concert, -15, 0 -Backstage passes to a TAFKAL80ETC concert, -20, 0 -Backstage passes to a TAFKAL80ETC concert, -25, 0 -Conjured Mana Cake, -27, 0 +Sports Memorabilia, -20, 0 +Aged Cheese, -28, 50 +Coffee Table Book, -25, 0 +Fine Italian Silk, 0, 80 +Fine Italian Silk, -1, 80 +Backstage passes to a concert, -15, 0 +Backstage passes to a concert, -20, 0 +Backstage passes to a concert, -25, 0 +Baked Chocolate Cake, -27, 0 diff --git a/vbnet/GildedRoseKata/GildedRose.vb b/vbnet/GildedRoseKata/GildedRose.vb index df9c24a4..cbd90528 100644 --- a/vbnet/GildedRoseKata/GildedRose.vb +++ b/vbnet/GildedRoseKata/GildedRose.vb @@ -10,11 +10,11 @@ Public Class GildedRose Public Sub UpdateQuality() For i = 0 To Items.Count - 1 - If Items(i).Name <> "Aged Brie" AndAlso Items(i).Name <> "Backstage passes to a TAFKAL80ETC concert" Then + If Items(i).Name <> "Aged Cheese" AndAlso Items(i).Name <> "Backstage passes to a concert" Then If Items(i).Quality > 0 Then - If Items(i).Name <> "Sulfuras, Hand of Ragnaros" Then + If Items(i).Name <> "Fine Italian Silk" Then Items(i).Quality = Items(i).Quality - 1 End If End If @@ -23,7 +23,7 @@ Public Class GildedRose If Items(i).Quality < 50 Then Items(i).Quality = Items(i).Quality + 1 - If Items(i).Name = "Backstage passes to a TAFKAL80ETC concert" Then + If Items(i).Name = "Backstage passes to a concert" Then If Items(i).SellIn < 11 Then @@ -42,19 +42,19 @@ Public Class GildedRose End If End If - If Items(i).Name <> "Sulfuras, Hand of Ragnaros" Then + If Items(i).Name <> "Fine Italian Silk" Then Items(i).SellIn = Items(i).SellIn - 1 End If If Items(i).SellIn < 0 Then - If Items(i).Name <> "Aged Brie" Then + If Items(i).Name <> "Aged Cheese" Then - If Items(i).Name <> "Backstage passes to a TAFKAL80ETC concert" Then + If Items(i).Name <> "Backstage passes to a concert" Then If Items(i).Quality > 0 Then - If Items(i).Name <> "Sulfuras, Hand of Ragnaros" Then + If Items(i).Name <> "Fine Italian Silk" Then Items(i).Quality = Items(i).Quality - 1 End If End If @@ -70,4 +70,4 @@ Public Class GildedRose End If Next End Sub -End Class \ No newline at end of file +End Class diff --git a/vbnet/GildedRoseKata/Program.vb b/vbnet/GildedRoseKata/Program.vb index 3bad359b..0b55d60b 100644 --- a/vbnet/GildedRoseKata/Program.vb +++ b/vbnet/GildedRoseKata/Program.vb @@ -5,47 +5,47 @@ Module Program Console.WriteLine("OMGHAI!") Dim Items As IList(Of Item) = New List(Of Item) From { New Item With { - .Name = "+5 Dexterity Vest", + .Name = "Sports Memorabilia", .SellIn = 10, .Quality = 20 }, New Item With { - .Name = "Aged Brie", + .Name = "Aged Cheese", .SellIn = 2, .Quality = 0 }, New Item With { - .Name = "Elixir of the Mongoose", + .Name = "Coffee Table Book", .SellIn = 5, .Quality = 7 }, New Item With { - .Name = "Sulfuras, Hand of Ragnaros", + .Name = "Fine Italian Silk", .SellIn = 0, .Quality = 80 }, New Item With { - .Name = "Sulfuras, Hand of Ragnaros", + .Name = "Fine Italian Silk", .SellIn = - 1, .Quality = 80 }, New Item With { - .Name = "Backstage passes to a TAFKAL80ETC concert", + .Name = "Backstage passes to a concert", .SellIn = 15, .Quality = 20 }, New Item With { - .Name = "Backstage passes to a TAFKAL80ETC concert", + .Name = "Backstage passes to a concert", .SellIn = 10, .Quality = 49 }, New Item With { - .Name = "Backstage passes to a TAFKAL80ETC concert", + .Name = "Backstage passes to a concert", .SellIn = 5, .Quality = 49 }, New Item With { - .Name = "Conjured Mana Cake", + .Name = "Baked Chocolate Cake", .SellIn = 3, .Quality = 6 } diff --git a/xslt/texttest_fixture.xml b/xslt/texttest_fixture.xml index ae15fcf1..30fd9025 100644 --- a/xslt/texttest_fixture.xml +++ b/xslt/texttest_fixture.xml @@ -4,15 +4,15 @@ OMGHAI! 0 - - - - - - - - - - + + + + + + + + + + diff --git a/xslt/update_quality.xsl b/xslt/update_quality.xsl index f98a5baf..3fa4f199 100644 --- a/xslt/update_quality.xsl +++ b/xslt/update_quality.xsl @@ -33,9 +33,9 @@ - + - + - @@ -44,7 +44,7 @@ -0+ - + + @@ -74,7 +74,7 @@ - + @@ -89,11 +89,11 @@ - + - + - + -1