Battleship is a web-based game that simulates the classic board game of the same name. The objective of the game is to sink all the enemy ships before they sink yours.
- You can play against a computer opponent that randomly places and fires at ships.
- You can see the status of your own ships and the enemy’s hits and misses on a grid.
This project is made with JavaScript, HTML and CSS. It also uses the following tools and libraries:
- Jest: A JavaScript testing framework that allows test-driven development.
- Babel: A JavaScript compiler that transforms modern syntax into browser-compatible code.
- Webpack: A module bundler that bundles JavaScript files and assets into a single file.
To install this project, you need to have Node.js and npm installed on your machine. Then follow these steps:
- Clone this repository: git clone https://github.com/N3mEee/Battleship.git
- Navigate to the project folder:
cd Battleship
- Install the dependencies:
npm install
- Run the tests:
npm test
- Build the project:
npm run build
- Open the index.html file in your browser.
To play the game, follow these steps:
Click on any cell on your grid to place a ship. You can rotate a ship by pressing R or clicking on it again.
Work in Progress- When you are done placing your ships, click on Start Game.
- Click on any cell on the enemy grid to fire at it. You will see a red cell if you hit a ship, or a gray cell if you miss.
- The game ends when either you or the enemy sinks all the ships.
This project is inspired by The Odin Project, an online curriculum for learning web development.