A browser-based Battleship game where you strategically deploy your fleet and battle a computer opponent until one side's ships are completely sunk.
-
Fleet Duel was built with the main purpose to explore TypeScript and Test-Driven Development (TDD)
-
The project was developed by writing and testing the core game logic before building the user interface. The
Ship,Gameboard, andPlayerclasses are covered by unit tests using Jest, ensuring reliable game mechanics. -
The codebase follows a modular architecture with a clear separation of concerns. Reusable classes encapsulate the game logic, the UI layer handles rendering and user interactions, and game.ts orchestrates the overall game flow, turn management, and win conditions.
- Enter your name and deploy your fleet.
- Place all five ships on your board, ships can be positioned horizontally or vertically.
- Attack the enemy board by selecting a target cell. The computer responds with its own attack.
- Continue taking turns until one player's all ships has been sunk.
- A result screen displays the outcome and allows you to start a new game.
Note
If you prefer not to install it locally, you can also access the live demo version
To set up the Fleet Duel Application locally, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/imanabshar/fleet-duel.git
-
Navigate to the project's directory:
cd fleet-duel -
Install the project's dependencies:
npm install
-
Start the development server:
npm run dev
-
Run the test:
npm test
