Skip to content

Command-line implementation of the board game, "Battleship"

Notifications You must be signed in to change notification settings

connorsullivan/battleship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Battleship Game

This project is a command-line implementation of the popular board game, "Battleship".

Rules

The game is single-player (e.g. you play against a bot).

Each player takes turns choosing a position to attack on their opponent's board (you pick first).

The outcome of an attack is one of the following scenerios:

  • Miss
  • Hit
  • Sunk
  • Victory

The game board is a 10 x 10 square (100 possible positions).

Each player has a fleet of ships of varying sizes that are randomly placed on the board at the start of the game:

  • 1 large ship (size 4)
  • 2 medium ships (size 3)
  • 3 small ships (size 2)
  • 4 micro ships (size 1)

For a total of 10 ships and 20 occupied positions (out of 100 total, or 20% of the board).

The game is over when all the ships on a player's board are destroyed (sunk).

Getting Started

Simply clone the project to your system and run the "Game.py" file with Python 3 in a command-line window.

git clone [project]

cd [project]/src

python Game.py (you might need to use the python3 command on some systems)

Prerequisites

The only requirement to run this game is Python 3.

I used Python 3.7 when writing the code.

Authors

About

Command-line implementation of the board game, "Battleship"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages