Gameplay - ThindAmrit17/Battleship GitHub Wiki

Battleship - Rules and Restrictions

Grid and Set-Up

The game consists of the user pitted against an AI player, with each player commanding their own naval fleet comprised of 6 battleships. Each player has access to 2 10x10 grids:

  • a primary grid where players position their ships
  • a tracking grid which allows players to record their moves made and results (hit, miss)

Squares within a grid can be identified by a letter-number coordinate (A-J, 0-9). Players cannot see the other player's primary grid. Instead, they can use the tracking grid to estimate and guess positions of enemy ships based on past shots. Ships are rectangular in shape, with a width of 1 square and a length which varies depending on ship class.

Setting the Stage

At the start of the game, players set up their navy by placing ships on their primary grid. Ships can be placed anywhere on the grid so long as they:

  • don't overlap with each other
  • don't extend past the border of the grid

Classes of ships available:

# Class Size
1 Carrier 5
2 Battleship 4
3 Cruiser 3
4 Submarine 2
5 Destroyer 1

Combat

Players take turns firing shots at a coordinate on the opposing player's primary grid. If the target shares a coordinate with an enemy ship, it counts as a hit. Otherwise, it misses and falls right into the water. Each shot made by a player is recorded on their tracking screen. A red square indicates a hit, and a white square indicates a miss. Ships are operational until all squares comprising them have been hit.

The game ends when either player loses all operational ships on their primary grid. The other player is declared the winner.

⚠️ **GitHub.com Fallback** ⚠️