Skip to content

wscullen/battleship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Battleship Game

Dependencies

  • python 3.7
  • python packages tabulate, coverage

Install

pip install -r requirements.txt

Run Tests

python -m unittest discover

Run Code Coverage Check

coverage run -m unittest discover

View results:

coverage report

Playing the Game

Launch the game with python game.py from your favorite terminal application.

The game is played with 2 players, with an 8 x 8 board.

Each player places a single ship of length 3, using the coordinate system LETTERNUMBER, for example A7, or B3.

+----+-----+-----+-----+-----+-----+-----+-----+-----+
|    | A   | B   | C   | D   | E   | F   | G   | H   |
+====+=====+=====+=====+=====+=====+=====+=====+=====+
|  1 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  2 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  3 |     |     | H   |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  4 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  5 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  6 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  7 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+
|  8 |     |     |     |     |     |     |     |     |
+----+-----+-----+-----+-----+-----+-----+-----+-----+

So the "H" above would be at C3.

Once the players place their ships, they take turns targeting each others ship.

The first player to destroy their opponent's ship by hitting all three sections of the ship wins.

About

Basic console version of Battleship.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages