diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..1cc4572e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea/workspace.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 00000000..c764764b
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+GuildedRose
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..217af471
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 00000000..3572571a
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 00000000..e206d70d
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..6e367118
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..4278bcdd
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 00000000..922003b8
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..9d32e507
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Java/.classpath b/Java/.classpath
new file mode 100644
index 00000000..3f0dbd34
--- /dev/null
+++ b/Java/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Java/.gitignore b/Java/.gitignore
new file mode 100644
index 00000000..2d7e4dc5
--- /dev/null
+++ b/Java/.gitignore
@@ -0,0 +1 @@
+*.class
diff --git a/Java/.project b/Java/.project
new file mode 100644
index 00000000..a27d7900
--- /dev/null
+++ b/Java/.project
@@ -0,0 +1,17 @@
+
+
+ GildedRose.java
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Java/Java.iml b/Java/Java.iml
new file mode 100644
index 00000000..3dfffce3
--- /dev/null
+++ b/Java/Java.iml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/com/gildedrose/GildedRose.java b/Java/com/gildedrose/GildedRose.java
old mode 100755
new mode 100644
index 8acc098d..ff5e55ae
--- a/Java/com/gildedrose/GildedRose.java
+++ b/Java/com/gildedrose/GildedRose.java
@@ -1,61 +1,62 @@
-package com.gildedrose;
-class GildedRose {
- Item[] items;
-
- public GildedRose(Item[] items) {
- this.items = items;
- }
-
- public void updateQuality() {
- for (int i = 0; i < items.length; i++) {
- if (!items[i].name.equals("Aged Brie")
- && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
- if (items[i].quality > 0) {
- if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
- items[i].quality = items[i].quality - 1;
- }
- }
- } else {
- if (items[i].quality < 50) {
- items[i].quality = items[i].quality + 1;
-
- if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
- if (items[i].sellIn < 11) {
- if (items[i].quality < 50) {
- items[i].quality = items[i].quality + 1;
- }
- }
-
- if (items[i].sellIn < 6) {
- if (items[i].quality < 50) {
- items[i].quality = items[i].quality + 1;
- }
- }
- }
- }
- }
-
- if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
- items[i].sellIn = items[i].sellIn - 1;
- }
-
- if (items[i].sellIn < 0) {
- if (!items[i].name.equals("Aged Brie")) {
- if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
- if (items[i].quality > 0) {
- if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
- items[i].quality = items[i].quality - 1;
- }
- }
- } else {
- items[i].quality = items[i].quality - items[i].quality;
- }
- } else {
- if (items[i].quality < 50) {
- items[i].quality = items[i].quality + 1;
- }
- }
- }
- }
- }
-}
+package com.gildedrose;
+
+class GildedRose {
+ Item[] items;
+
+ public GildedRose(Item[] items) {
+ this.items = items;
+ }
+
+ public void updateQuality() {
+ for (int i = 0; i < items.length; i++) {
+ if (!items[i].name.equals("Aged Brie")
+ && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
+ if (items[i].quality > 0) {
+ if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
+ items[i].quality = items[i].quality - 1;
+ }
+ }
+ } else {
+ if (items[i].quality < 50) {
+ items[i].quality = items[i].quality + 1;
+
+ if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
+ if (items[i].sellIn < 11) {
+ if (items[i].quality < 50) {
+ items[i].quality = items[i].quality + 1;
+ }
+ }
+
+ if (items[i].sellIn < 6) {
+ if (items[i].quality < 50) {
+ items[i].quality = items[i].quality + 1;
+ }
+ }
+ }
+ }
+ }
+
+ if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
+ items[i].sellIn = items[i].sellIn - 1;
+ }
+
+ if (items[i].sellIn < 0) {
+ if (!items[i].name.equals("Aged Brie")) {
+ if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
+ if (items[i].quality > 0) {
+ if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
+ items[i].quality = items[i].quality - 1;
+ }
+ }
+ } else {
+ items[i].quality = items[i].quality - items[i].quality;
+ }
+ } else {
+ if (items[i].quality < 50) {
+ items[i].quality = items[i].quality + 1;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Java/com/gildedrose/GildedRoseTest.java b/Java/com/gildedrose/GildedRoseTest.java
index 49517932..d679c458 100644
--- a/Java/com/gildedrose/GildedRoseTest.java
+++ b/Java/com/gildedrose/GildedRoseTest.java
@@ -1,15 +1,17 @@
-package com.gildedrose;
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class GildedRoseTest {
-
- @Test
- public void foo() {
- Item[] items = new Item[] { new Item("foo", 0, 0) };
- GildedRose app = new GildedRose(items);
- app.updateQuality();
- assertEquals("fixme", app.items[0].name);
- }
-}
+package com.gildedrose;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class GildedRoseTest {
+
+ @Test
+ public void foo() {
+ Item[] items = new Item[] { new Item("foo", 0, 0) };
+ GildedRose app = new GildedRose(items);
+ app.updateQuality();
+ assertEquals("fixme", app.items[0].name);
+ }
+
+}
diff --git a/Java/com/gildedrose/Item.java b/Java/com/gildedrose/Item.java
old mode 100755
new mode 100644
index 779aad79..33ab7398
--- a/Java/com/gildedrose/Item.java
+++ b/Java/com/gildedrose/Item.java
@@ -1,19 +1,20 @@
-package com.gildedrose;
-public class Item {
-
- public String name;
-
- public int sellIn;
-
- public int quality;
-
- public Item(String name, int sellIn, int quality) {
- this.name = name;
- this.sellIn = sellIn;
- this.quality = quality;
- }
-
- public String toString() {
- return this.name + ", " + this.sellIn + ", " + this.quality;
- }
-}
+package com.gildedrose;
+
+public class Item {
+
+ public String name;
+
+ public int sellIn;
+
+ public int quality;
+
+ public Item(String name, int sellIn, int quality) {
+ this.name = name;
+ this.sellIn = sellIn;
+ this.quality = quality;
+ }
+
+ public String toString() {
+ return this.name + ", " + this.sellIn + ", " + this.quality;
+ }
+}
diff --git a/Java/com/gildedrose/TexttestFixture.java b/Java/com/gildedrose/TexttestFixture.java
old mode 100755
new mode 100644
index bd6a50ce..821b7f1d
--- a/Java/com/gildedrose/TexttestFixture.java
+++ b/Java/com/gildedrose/TexttestFixture.java
@@ -1,36 +1,37 @@
-package com.gildedrose;
-
-public class TexttestFixture {
- 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) };
-
- GildedRose app = new GildedRose(items);
-
- int days = 2;
- if (args.length > 0) {
- days = Integer.parseInt(args[0]) + 1;
- }
-
- for (int i = 0; i < days; i++) {
- System.out.println("-------- day " + i + " --------");
- System.out.println("name, sellIn, quality");
- for (Item item : items) {
- System.out.println(item);
- }
- System.out.println();
- app.updateQuality();
- }
- }
-
-}
\ No newline at end of file
+package com.gildedrose;
+
+public class TexttestFixture {
+ 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) };
+
+ GildedRose app = new GildedRose(items);
+
+ int days = 2;
+ if (args.length > 0) {
+ days = Integer.parseInt(args[0]) + 1;
+ }
+
+ for (int i = 0; i < days; i++) {
+ System.out.println("-------- day " + i + " --------");
+ System.out.println("name, sellIn, quality");
+ for (Item item : items) {
+ System.out.println(item);
+ }
+ System.out.println();
+ app.updateQuality();
+ }
+ }
+
+}
diff --git a/js/.gitignore b/js/.gitignore
deleted file mode 100644
index 8447f276..00000000
--- a/js/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.swp
-*~
-*.bak
diff --git a/js/README.md b/js/README.md
deleted file mode 100644
index 76868f59..00000000
--- a/js/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-If you want to get cracking on the JavaScript source then do this:
-
- git clone git@github.com:guyroyse/gilded-rose-javascript.git
-
-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. 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:
-
- - All items have a *sell_in* 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
-
- - At the end of each day our system lowers both values for every item
-
-Pretty simple, right? Well this is where it gets interesting:
-
- - Once the *sell_in* days is less then zero, *quality* degrades twice as fast
-
- - The *quality* of an item is never negative
-
- - "Aged Brie" 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 nor does it
- decrease in *quality*
-
- - "Backstage passes", like aged brie, increases in *quality* as it's *sell_in*
- value decreases; *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
-
-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 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.
-
-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.
-
-Sources:
-
-
diff --git a/js/spec/gilded_rose_spec.js b/js/spec/gilded_rose_spec.js
index 6522757b..4b60ad34 100644
--- a/js/spec/gilded_rose_spec.js
+++ b/js/spec/gilded_rose_spec.js
@@ -1,7 +1,9 @@
describe("Gilded Rose", function() {
- it("should do something", function() {
- update_quality
+ it("should foo", function() {
+ items = [ new Item("foo", 0, 0) ];
+ update_quality();
+ expect(items[0].name).toEqual("fixme");
});
});
diff --git a/python/test_gilded_rose.py b/python/test_gilded_rose.py
index 51480d19..2c66711b 100644
--- a/python/test_gilded_rose.py
+++ b/python/test_gilded_rose.py
@@ -3,7 +3,6 @@ import unittest
from gilded_rose import Item, GildedRose
-
class GildedRoseTest(unittest.TestCase):
def test_foo(self):
items = [Item("foo", 0, 0)]
diff --git a/python/texttest_fixture.py b/python/texttest_fixture.py
index f867345e..86af5ef7 100644
--- a/python/texttest_fixture.py
+++ b/python/texttest_fixture.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
+
from gilded_rose import *
if __name__ == "__main__":
diff --git a/ruby/.buildpath b/ruby/.buildpath
new file mode 100644
index 00000000..47f1b520
--- /dev/null
+++ b/ruby/.buildpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruby/.loadpath b/ruby/.loadpath
new file mode 100644
index 00000000..b7db479f
--- /dev/null
+++ b/ruby/.loadpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ruby/.project b/ruby/.project
new file mode 100644
index 00000000..fcc43146
--- /dev/null
+++ b/ruby/.project
@@ -0,0 +1,23 @@
+
+
+ GildedRose.rb
+
+
+
+
+
+ org.rubypeople.rdt.core.rubybuilder
+
+
+
+
+ org.eclipse.dltk.core.scriptbuilder
+
+
+
+
+
+ org.rubypeople.rdt.core.rubynature
+ org.eclipse.dltk.ruby.core.nature
+
+
diff --git a/ruby/gilded_rose.rb b/ruby/gilded_rose.rb
old mode 100755
new mode 100644
index 76cd93c4..3c260621
--- a/ruby/gilded_rose.rb
+++ b/ruby/gilded_rose.rb
@@ -1,68 +1,68 @@
-
-class GildedRose
- def initialize(items)
- @items = items
- end
-
- def update_quality()
- @items.each do |item|
- if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
- if item.quality > 0
- if item.name != "Sulfuras, Hand of Ragnaros"
- 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.sell_in < 11
- if item.quality < 50
- item.quality = item.quality + 1
- end
- end
- if item.sell_in < 6
- if item.quality < 50
- item.quality = item.quality + 1
- end
- end
- end
- end
- end
- if item.name != "Sulfuras, Hand of Ragnaros"
- 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.quality > 0
- if item.name != "Sulfuras, Hand of Ragnaros"
- item.quality = item.quality - 1
- end
- end
- else
- item.quality = item.quality - item.quality
- end
- else
- if item.quality < 50
- item.quality = item.quality + 1
- end
- end
- end
- end
- end
-end
-
-class Item
- attr_accessor :name, :sell_in, :quality
-
- def initialize(name, sell_in, quality)
- @name = name
- @sell_in = sell_in
- @quality = quality
- end
-
- def to_s()
- "#{@name}, #{@sell_in}, #{@quality}"
- end
+class GildedRose
+
+ def initialize(items)
+ @items = items
+ end
+
+ def update_quality()
+ @items.each do |item|
+ if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
+ if item.quality > 0
+ if item.name != "Sulfuras, Hand of Ragnaros"
+ 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.sell_in < 11
+ if item.quality < 50
+ item.quality = item.quality + 1
+ end
+ end
+ if item.sell_in < 6
+ if item.quality < 50
+ item.quality = item.quality + 1
+ end
+ end
+ end
+ end
+ end
+ if item.name != "Sulfuras, Hand of Ragnaros"
+ 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.quality > 0
+ if item.name != "Sulfuras, Hand of Ragnaros"
+ item.quality = item.quality - 1
+ end
+ end
+ else
+ item.quality = item.quality - item.quality
+ end
+ else
+ if item.quality < 50
+ item.quality = item.quality + 1
+ end
+ end
+ end
+ end
+ end
+end
+
+class Item
+ attr_accessor :name, :sell_in, :quality
+
+ def initialize(name, sell_in, quality)
+ @name = name
+ @sell_in = sell_in
+ @quality = quality
+ end
+
+ def to_s()
+ "#{@name}, #{@sell_in}, #{@quality}"
+ end
end
\ No newline at end of file
diff --git a/ruby/texttest_fixture.rb b/ruby/texttest_fixture.rb
index b9d26c28..25dd5f66 100644
--- a/ruby/texttest_fixture.rb
+++ b/ruby/texttest_fixture.rb
@@ -1,33 +1,33 @@
-#!/usr/bin/ruby -w
-
-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
- ]
-
-days = 2
-if ARGV.size > 0
- days = ARGV[0].to_i + 1
-end
-
-gilded_rose = GildedRose.new items
-(0...days).each do |day|
- puts "-------- day #{day} --------"
- puts "name, sellIn, quality"
- items.each do |item|
- puts item
- end
- puts ""
- gilded_rose.update_quality
-end
+#!/usr/bin/ruby -w
+
+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
+]
+
+days = 2
+if ARGV.size > 0
+ days = ARGV[0].to_i + 1
+end
+
+gilded_rose = GildedRose.new items
+(0...days).each do |day|
+ puts "-------- day #{day} --------"
+ puts "name, sellIn, quality"
+ items.each do |item|
+ puts item
+ end
+ puts ""
+ gilded_rose.update_quality
+end