Skip to content

Repository files navigation

Fleet Duel

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 Preview

Project Overview

  • 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, and Player classes 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.

Gameplay

  1. Enter your name and deploy your fleet.
  2. Place all five ships on your board, ships can be positioned horizontally or vertically.
  3. Attack the enemy board by selecting a target cell. The computer responds with its own attack.
  4. Continue taking turns until one player's all ships has been sunk.
  5. A result screen displays the outcome and allows you to start a new game.

Installation

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:

  1. Clone the repository to your local machine:

    git clone https://github.com/imanabshar/fleet-duel.git
  2. Navigate to the project's directory:

    cd fleet-duel
  3. Install the project's dependencies:

    npm install
  4. Start the development server:

    npm run dev
  5. Run the test:

    npm test

Built With

HTML5    CSS3    TypeScript    Vite    Jest    ts-jest

About

A battleship game featuring interactive ship placement and turn-based gameplay.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages