Adds feature: welcome message

Implements the welcome message feature
Creates spec_file for Cli class which implements
the command line interface for the game.
Creates the bin file which should be executed to start
the cli interface.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds feature: setup new game

Adds feature and step definitions, including game,
player and ship specs.
Implements code to comply with specs.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds support for creating ships from strings

Adds the Ship.create(ship) method which is a helper method to allow the
creation of ship objects from its name, initial or symbol.
For example:
  Ship.create('submarine')    # => Submarine.new
  Ship.create('D')            # => Destroyer.new
  Ship.create(:A)             # => AircraftCarrier.new

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Fixed issue in Ast::Table.to_board helper method

Corrected the loading of cucumber table objects on the to_board method
to a hash representation of the board object.
Supports step definitions of features with board specifications.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Initial implementation of the Board object

Adds the board attribute to the Player object.

Implementation of the Board supports a to_hash method that produces a
hash representation of the board object and == method that allows
comparing two boards regarding their matrix content.

Also specifies columns and rows acceptable to index the board matrix.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Corrected typo in spec/player_spec.rb

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Stripped not applicable information from feature

Reduced the background information to the base minimum
necessary to justify the feature

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Minor refactoring of step definition

Replaced "...inject([]) { |ships, s|..." with "...collect { |ship|..."
Allows to avoid outer variable shadowing and simplifying code

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds ship list index support

Sets a predefined ordering for ships when placed on lists
Also sets public API methods to abstract api users from this order
Example: Destroyer::INDEX
         Ship.index("battleship") or Ship.index(:B) or Ship.index("B")

Ship.index returns Ship::TOTAL_SHIPS when no ship match, which causes
Ship.create to return nil as a last resort.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Reimplementation of the Board

Board objects are now based on a bidimensiol array instead of the old
hash of rows arrays.
Board#== method now supports comparation with arrays, hashes and other
board objects
Updates Cucumber::Ast::Table#to_board helper method implementation to
comply with the new Board implementation.
Removes Board::ROWS and Board::COLS constants. These are now easy
accessed by calling @board.to_hash.keys and @board.board.length which
will be a temporary solution. Further improvements on this area need
to be made.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Changes Ship.ships to comply with Ship::INDEX order

The array returned by Ship.ships now complies with the ordering
index specified by Ship::INDEX.
Avoids duplicate changes in case of reordering, all business logic is
based on the INDEX values.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Add player specifies location feature description

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Improves functionality of Ship.index and .create

Rewrites the Ship.index and Ship.create specs to produce better
documentation.
Adds support for indexing Ship.ships array regarding Ship::INDEX.
Adds fixnum index validation functionality to Ship.index method and
addapts it to be used with Ship.create and future ship array lists.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds Player#ship as a #ships index helper method

Adds Player#ship method as a helper method to access a specific ship
inside the array of a player's ships returned by Player#ships.
It makes heavy use of Ship.index for validation and translation of
ship identifiers(String, Symbol and Fixnum) to return the specified
ship passed as an argument.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Removed feature about api changes and its steps

After all it's a nonsense to describe code features with cucumber.
Just leave it to rspec and its generated documentation.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds ship location parser

Adds Board.parse_location to parse location strings to hashes with keys
:row, :col and :ori.
Implements the parser using regular expressions returning a usefull
hash as options for a future placing method and returning nil when no
the location is not valid.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds simplecov to the development environment

Adds simplecov to the rubaship.gemspec, and the folder coverage/ to the
.gitignore file.
Alters spec_helper.rb file to run simplecov before starting to load the
specs.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds .rvmrc file for ruby 1.9.3-p125@rubaship

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Improves Board access with #[] and .row_to_index

Adds Board#[] method and .row_to_index helper method to provide easier
api access to the contents of the board.
Board.row_to_index allow to translate row identifiers based on a symbol
or a String to its equivalent index value.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds feature place ships on the board and steps

Adds Place ships on the board feature along with step definitions

Signed-off-by: João Soares <jsoaresgeral@gmail.com>