Title: [jbehave] [650] trunk/examples/hellbound/src/stories: [EK] Finished the last stories for Hellbound

Diff

Modified: trunk/examples/hellbound/src/java/com/sirenian/hellbound/Hellbound.java (649 => 650)

--- trunk/examples/hellbound/src/java/com/sirenian/hellbound/Hellbound.java	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/java/com/sirenian/hellbound/Hellbound.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -46,7 +46,7 @@
                 new ThreadedSwingQueue(),
                 new AcceleratingHeartbeat(), 
                 new PitPanel(SCALE, WIDTH, HEIGHT, COLORMAP), 
-                new PseudoRandomGlyphFactory(7, 13));
+                new PseudoRandomGlyphFactory(42, 7, 13));
     }
 
     public Hellbound(EngineQueue engineQueue, GuiQueue guiQueue,

Modified: trunk/examples/hellbound/src/stories/TheGlyphIsConstrainedByThePit.story (649 => 650)

--- trunk/examples/hellbound/src/stories/TheGlyphIsConstrainedByThePit.story	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/stories/TheGlyphIsConstrainedByThePit.story	2007-01-03 14:47:18 UTC (rev 650)
@@ -8,17 +8,59 @@
 
 Given the glyph is against the right wall
 When the player presses the right key
-Then the glyph will not move
+Then the glyph should be against the right wall
+....TTT
+.....T.
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
 
+
 Scenario: the glyph will not move left
 
 Given the glyph is against the left wall
 When the player presses the left key
-Then the glyph will not move
+Then the glyph should be against the left wall
+TTT....
+.T.....
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
 
+
 Scenario: the glyph will not move down
 
-Given the glyph is against the floor
-When the player presses the down key
-Then the glyph becomes junk
-and the next glyph appears
+Given the first glyph is displayed on the board
+When the player presses the drop key
+and the player presses the down key
+Then the glyph should become junk and the next glyph should appear
+..ZZ...
+...ZZ..
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+..XXX..
+...X...
+

Modified: trunk/examples/hellbound/src/stories/ThePlayerDropsTheGlyph.story (649 => 650)

--- trunk/examples/hellbound/src/stories/ThePlayerDropsTheGlyph.story	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/stories/ThePlayerDropsTheGlyph.story	2007-01-03 14:47:18 UTC (rev 650)
@@ -10,13 +10,54 @@
 When the player presses the drop key
 Then the glyph should fall to the bottom
 When time passes
-Then the glyph segments should become junk
-and the next glyph should appear
+Then the glyph should become junk and the next glyph should appear
+..ZZ...
+...ZZ..
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+..XXX..
+...X...
 
+
 Scenario: the player drops the glyph onto junk
 
 Given the player drops the glyph into an empty pit
 When the player presses the drop key
 Then the glyph should fall onto the junk
-and the glyph segments should become junk
-and the next glyph should appear
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+..ZZ...
+...ZZ..
+..XXX..
+...X...
+
+When time passes
+Then the glyph should become junk and the next glyph should appear
+...SS..
+..SS...
+.......
+.......
+.......
+.......
+.......
+.......
+.......
+..XX...
+...XX..
+..XXX..
+...X...
+

Modified: trunk/examples/hellbound/src/stories/ThePlayerInteractsWithTheGlyph.story (649 => 650)

--- trunk/examples/hellbound/src/stories/ThePlayerInteractsWithTheGlyph.story	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/stories/ThePlayerInteractsWithTheGlyph.story	2007-01-03 14:47:18 UTC (rev 650)
@@ -7,25 +7,25 @@
 Scenario: the player moves the glyph
 
 Given the first glyph is displayed on the board
-When the player presses the right button
-Then the glyph moves right
-When the player presses the left button
-Then the glyph moves left
-When the player presses the down button
-Then the glyph moves down
-and the heartbeat is interrupted
+When the player presses the right key
+Then the glyph should move right
+When the player presses the left key
+Then the glyph should be centred at the top of the pit
+When the player presses the down key
+Then the glyph should move downwards
+and the heartbeat should be skipped
 
 Scenario: the player rotates the glyph left
 
 Given the first glyph is displayed on the board
 When the player presses left rotate
-Then the glyph turns to one quarter
+Then the glyph should turn to one quarter
 When the player presses left rotate
-Then the glyph turns to one half
+Then the glyph turns to two quarters
 When the player presses left rotate
 Then the glyph turns to three quarters
 When the player presses left rotate
-Then the glyph turns to upright
+Then the glyph should be centred at the top of the pit
 
 Scenario: the player rotates the glyph right
 
@@ -33,10 +33,8 @@
 When the player presses right rotate
 Then the glyph turns to three quarters
 When the player presses right rotate
-Then the glyph turns to one half
+Then the glyph turns to two quarters
 When the player presses right rotate
-Then the glyph turns to one quarter
+Then the glyph should turn to one quarter
 When the player presses right rotate
-Then the glyph turns to upright
-
-
+Then the glyph should be centred at the top of the pit

Modified: trunk/examples/hellbound/src/stories/ThePlayerLosesTheGame.story (649 => 650)

--- trunk/examples/hellbound/src/stories/ThePlayerLosesTheGame.story	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/stories/ThePlayerLosesTheGame.story	2007-01-03 14:47:18 UTC (rev 650)
@@ -4,12 +4,24 @@
 I want to lose the game
 So that the game is a challenge
 
-Scenario: no space for the next glyph
+Scenario: there is no space for the next glyph
 
-Given that the junk is almost to the top
-When the glyph appears
-and the player drops it
+Given the junk is almost to the top
+When the player presses the drop key
 and time passes
-Then the glyph should add to the junk
-and the next glyph should appear overlapping the junk
+Then the glyph should become junk and the next glyph should appear overlapping it
+..L....
+..L....
+..LL...
+...XX..
+...X...
+...X...
+..XX...
+...XX..
+..XX...
+..XX...
+...XX..
+..XXX..
+...X...
+
 and the game should be over

Modified: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/ThePlayerPressesLeftRotate.java (649 => 650)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/ThePlayerPressesLeftRotate.java	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/ThePlayerPressesLeftRotate.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -5,8 +5,7 @@
 public class ThePlayerPressesLeftRotate extends HellboundEvent {
 
     protected void occurAnyTimeIn(World world) {
-        // TODO Auto-generated method stub
-
+        pressKey('x', world);
     }
 
 }

Modified: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/ThePlayerPressesRightRotate.java (649 => 650)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/ThePlayerPressesRightRotate.java	2007-01-03 11:54:20 UTC (rev 649)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/ThePlayerPressesRightRotate.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -1,12 +1,11 @@
 package com.sirenian.hellbound.events;
 
-import org.jbehave.core.exception.PendingException;
 import org.jbehave.core.story.domain.World;
 
 public class ThePlayerPressesRightRotate extends HellboundEvent {
 
     protected void occurAnyTimeIn(World world) {
-        throw new PendingException();
+        pressKey('x', world);
     }
 
 }

Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheLineShouldDisappearAndTheNextGlyphShouldAppear.java (0 => 650)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheLineShouldDisappearAndTheNextGlyphShouldAppear.java	                        (rev 0)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheLineShouldDisappearAndTheNextGlyphShouldAppear.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -0,0 +1,24 @@
+package com.sirenian.hellbound.outcomes;
+
+
+public class TheLineShouldDisappearAndTheNextGlyphShouldAppear extends
+        ThePitShouldLookLike {
+
+    public TheLineShouldDisappearAndTheNextGlyphShouldAppear() {
+        super(
+                "..ZZ..." + NL +
+                "...ZZ.." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "...X..." + NL +
+                "...XX.X" + NL +
+                ".XXXX.X" + NL
+                );
+    }
+}

Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkHasAHoleAndAGlyphOfTheRightShapeIsAboveIt.java (0 => 650)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkHasAHoleAndAGlyphOfTheRightShapeIsAboveIt.java	                        (rev 0)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkHasAHoleAndAGlyphOfTheRightShapeIsAboveIt.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -0,0 +1,57 @@
+package com.sirenian.hellbound.scenarios;
+
+import com.sirenian.hellbound.events.ThePlayerPressesLeftRotate;
+import com.sirenian.hellbound.events.ThePlayerPressesRightRotate;
+import com.sirenian.hellbound.events.ThePlayerPressesTheDropKey;
+import com.sirenian.hellbound.events.ThePlayerPressesTheLeftKey;
+import com.sirenian.hellbound.events.ThePlayerPressesTheRightKey;
+import com.sirenian.hellbound.events.TimePasses;
+import com.sirenian.hellbound.outcomes.ThePitShouldLookLike;
+
+public class TheJunkHasAHoleAndAGlyphOfTheRightShapeIsAboveIt extends
+        HellboundScenario {
+
+    protected void specifySteps() {
+        given(new TheFirstGlyphIsDisplayedOnTheBoard());
+        
+        // T-shape to the left
+        when(new ThePlayerPressesRightRotate());
+        when(new ThePlayerPressesRightRotate());
+        when(new ThePlayerPressesTheLeftKey());
+        when(new ThePlayerPressesTheLeftKey());
+        when(new ThePlayerPressesTheDropKey());        
+        when(new TimePasses());
+        
+        // Z-shape next to it
+        when(new ThePlayerPressesTheDropKey());
+        when(new TimePasses());
+        
+        // S-shape on the Z-shape
+        when(new ThePlayerPressesTheRightKey());
+        when(new ThePlayerPressesLeftRotate());
+        when(new ThePlayerPressesTheDropKey());
+        when(new TimePasses());
+        
+        // J-shape ready to be dropped in hole
+        when(new ThePlayerPressesTheRightKey());
+        when(new ThePlayerPressesTheRightKey());
+        when(new ThePlayerPressesTheRightKey());
+        
+        then(new ThePitShouldLookLike(
+                "......J" + NL +
+                "......J" + NL +
+                ".....JJ" + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "......." + NL +
+                "...X..." + NL +
+                "...XX.." + NL +
+                ".XXXX.." + NL +
+                "XXXXX.." + NL
+                ));
+    }
+
+}

Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThePlayerDropsTheGlyphToMakeALine.java (0 => 650)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThePlayerDropsTheGlyphToMakeALine.java	                        (rev 0)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThePlayerDropsTheGlyphToMakeALine.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -0,0 +1,16 @@
+package com.sirenian.hellbound.scenarios;
+
+import com.sirenian.hellbound.events.ThePlayerPressesTheDropKey;
+import com.sirenian.hellbound.events.TimePasses;
+import com.sirenian.hellbound.outcomes.TheLineShouldDisappearAndTheNextGlyphShouldAppear;
+
+public class ThePlayerDropsTheGlyphToMakeALine extends HellboundScenario {
+
+    protected void specifySteps() {
+        given(new TheJunkHasAHoleAndAGlyphOfTheRightShapeIsAboveIt());
+        when(new ThePlayerPressesTheDropKey());
+        when(new TimePasses());
+        then(new TheLineShouldDisappearAndTheNextGlyphShouldAppear());
+    }
+
+}

Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerMakesALine.java (0 => 650)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerMakesALine.java	                        (rev 0)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerMakesALine.java	2007-01-03 14:47:18 UTC (rev 650)
@@ -0,0 +1,17 @@
+package com.sirenian.hellbound.stories;
+
+import org.jbehave.core.story.domain.Narrative;
+
+import com.sirenian.hellbound.scenarios.ThePlayerDropsTheGlyphToMakeALine;
+
+public class ThePlayerMakesALine extends HellboundStory {
+    
+    
+    public ThePlayerMakesALine() {
+        super(new Narrative("game player", "lines to disappear when I complete them", "I can progress the game"));
+    }
+
+    public void specify() {
+        addScenario(new ThePlayerDropsTheGlyphToMakeALine());
+    }
+}


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to