The Battleship is an application which implements Battleship (game) in Ruby language. This document contains implementation notes and gotcha's.
-
You can use the game like in the following file: console.rb
-
You could test/play by yourself in interactive mode/console by typing
ruby lib/console.rb
-
The ships cannot overlap (i.e., only one ship can occupy any given square in the grid). This is variant when ships can tauch only diagonal.
bad
..........
..XXX.....
....XXX...
..........
bad
..........
..XXXXXX..
..........
..........
good
..........
..XXX.....
.....XXX..
..........
-
D - debug mode
-
I - initialize game again with new fleet
-
Q - quit
Test coverage can be observed in the badge on the top of this file. If I find more time then I will try to improve it.
-
Game ends when you destory all the enemy's ships
-
Game ends when you type command 'Q'