- This is a console-based implementation of the classic game Battleship with an improved CLI graphics system.
- The final project of Marathon "Practice for beginners" in Java by Nail Alishev
- Stack: Java, Gradle
- Task
You will need to have Java 8+ and Gradle installed on your computer to run this game.
- Clone or download this repository to your local machine.
- Navigate to the project directory.
- Compile the
Interface.java
file by running the command javacMain.java
in the terminal. - Run the game by entering the command
java Main
in the terminal.
- Each player has a battlefield represented by a 10x10 grid (default) on which he places 10 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.
To place a ship you need to enter a departure coordinate (1.1-10.10 for the default 10x10 board) and a direction (vertical or horizontal).
- For example: "1" and '6' or "5" and '8'.
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 10 another player ships to win!
If all the ships of one of the players are destroyed, the game ends.