Skip to content

Instantly share code, notes, and snippets.

@jbpros
Created October 18, 2013 14:22
Show Gist options
  • Save jbpros/7042295 to your computer and use it in GitHub Desktop.
Save jbpros/7042295 to your computer and use it in GitHub Desktop.
Feature: fire at ships
Players want to fire at their opponent's ships so that they
can sink their whole fleet and have fun winning games.
* a player can fire at positions on the opponent's grid
* player can hit a ship or miss
* player hits the last remaining position of a ship: th ship is sunk
* two players
* turn-by-turn game
Scenario: fire and miss
Given it's my turn to play
And there is an unoccupied position
When I fire at that position
Then I miss
Scenario: fire and hit a ship
Given it's my turn to play
And there is an occupied position
When I fire at that position
Then I hit
Scenario: fire and sink a ship
Given it's my turn to play
And the last alive position of a ship
When I fire at that position
Then I sink the ship
Scenario: win the game
Given the last ship is almost sunk
When I sink that ship
Then I win
Scenario: lose the game
Given the my last ship is almost sunk
When my opponent sink that ship
Then I lose
Scenario: my turn to play
Given it's my turn to play
When I fire
Then my turn ends
And it's not my turn to play anymore
And it's my opponent's turn to play
Scenario: not my turn to play
Given it's not my turn to play
When I fire
Then I am asked to wait for my opponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment