This is a console-based implementation of the classic game Battleship with an improved CLI graphics system.
You will need to have Java 8+ installed on your computer to run this game.
- Clone or download this repository to your local machine.
- Navigate to the project directory.
- Compile the
Main.java
file by running the commandjavac Main.java
in the terminal. - Run the game by entering the command
java Main
in the terminal.
When you start the game the following menu appears on the home screen
Type a number in the menu to continue
- Type '1' to start playing classical game 10x10 vs the computer
- Type '2' to simulate a computer vs computer game 10x10
- Type '3' to see the rules and legend
- Type '0' to exit
- Each player has a battlefield represented by a 10x10 grid (default) on which he places 8 ships, hidden from his opponent.
- The goal of the game is to sink all the opposing ships! A ship is sunk when it is hit once for each space it occupies.
- In other words, a submarine, which occupies two spaces, is sunk after being hit twice.
- The 8 ships occupy 25 total spaces, so the first player to record 25 hits wins!
To place a ship you need to enter a departure coordinate (A1-J10 for the default 10x10 board) and a direction (vertical or horizontal).
- For example: "A1" and 'H' or "B7" and 'V'.
Ships shall not overlap or be adjacent and shall remain within the boundaries of the edge.
Once both players have configured their ships, the battle may have started!
- Shoot your opponent’s ships by matching the coordinates.
- You will be informed if you have hit or missed a ship.
- Sink all 8 computer ships to win!
This is a possible scenario of an end game. The rules and legend of the symbols are explained in detail in point 3 of the menu. Consult anytime if you have any doubts.
If you have any feedback, please reach out to us at [email protected]