Skip to content
Battleships game
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Battleships (or Sea Battle) is a guessing game for two players.

It is played with grids on which the players' fleets of ships are marked. The locations of the fleet are concealed from the other player. Players take alternate turns calling "shots" at the other player's ships, and the objective of the game is to destroy the opposing player's fleet first.

The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On a defensive grid, the player arranges their ships and records the shots made by the opponent, informing the opponent if it is a "miss" or a "hit". On the offensive grid, the player records the misses and hits.


Make a one-player version of the game where the ships are randomly positioned. The computer plays as the second player and just makes random moves, it doesn't necessarily make "smart" moves.

What you must know in order to complete the project

  1. Selection (if statements)
  2. Loops
  3. Methods
  4. Arrays (2-dimensional)
  5. How to generate a random number
  6. How to get user input (Scanner)


It is a good challenge for beginners, and could be tackled after doing a game like Tic Tac Toe.

You can’t perform that action at this time.