https://github.com/shvoruk/battleship
A Java Console Battleship Game: A feature-rich console-based Battleship game built with Java 23, featuring flexible board sizes, customizable ship configurations, dual-player modes (human vs. human and human vs. computer), move history, and full game replay functionality. Packaged with Maven and Docker.
https://github.com/shvoruk/battleship
battleship-game docker game java junit maven project
Last synced: over 1 year ago
JSON representation
A Java Console Battleship Game: A feature-rich console-based Battleship game built with Java 23, featuring flexible board sizes, customizable ship configurations, dual-player modes (human vs. human and human vs. computer), move history, and full game replay functionality. Packaged with Maven and Docker.
- Host: GitHub
- URL: https://github.com/shvoruk/battleship
- Owner: Shvoruk
- License: apache-2.0
- Created: 2025-03-03T12:58:15.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-17T14:45:05.000Z (over 1 year ago)
- Last Synced: 2025-03-17T15:44:47.671Z (over 1 year ago)
- Topics: battleship-game, docker, game, java, junit, maven, project
- Language: Java
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Battleship Game
[](https://github.com/Shvoruk/Battleship/blob/master/LICENSE)
[](https://github.com/Shvoruk/Battleship/releases)

## ⚓️ About the Project
**Battleship** is a console-based strategy game built with **Java 23**, designed to recreate the classic Battleship experience while introducing enhanced gameplay mechanics. The game supports both:
- **Single-player mode** (against computer with randomised shot selection)
- **Multiplayer mode** (two players on the same machine)
The game features **flexible board sizes and customisable ship configurations**. If you wish to introduce a new game mode, you can simply extend the `GameMode` class and configure its board size and ship fleet to suit your preferences.
Currently, the game offers:
- **Sea Mode (10×10 board, standard fleet)**
- **Ocean Mode (20×20 board, extended fleet for longer battles)**
This project is **still under development**, and new changes may be introduced in future updates. However, the current version is fully playable and implements all core mechanics.
## 🎣 Features
- Turn-based gameplay with an interactive board display
- Two game modes: Sea (10×10) and Ocean (20×20)
- Single-player mode (against computer with random shot selection)
- Multiplayer mode (two players on the same machine)
- Replay functionality for reviewing entire matches move-by-move
- "Extra Turn on Hit" rule, allowing a player to fire again if they hit a ship
- Packaged with Maven and Docker, the game is easy to set up and deploy across different systems.
## 🛠️ Installation & Setup
### Requirements
Before running the game, ensure you have the following installed on your machine:
-  **Java Development Kit (JDK 23) (for running the game directly)**
-  **Apache Maven (for building the project)**
-  **Docker (if you choose to use the Docker setup)**
-  **Git (for cloning the repository)**
### Using Maven
To get started with the game, follow these steps:
1. **Clone the Repository**
```sh
git clone https://github.com/Shvoruk/Battleship
2. **Navigate to the Project directory**
```sh
cd Battleship
3. **Build the Project**
```sh
mvn clean package
4. **Run the Game**
```sh
java -jar target/Battleship-1.0.0.jar
### Using Docker
3. **Build the Docker Image**
```sh
docker build -t battleship .
4. **Run the Container**
```sh
docker run -it battleship