Welcome to the Battleship Game! This is a classic naval combat game where you and your opponent take turns trying to sink each other's ships.
- Objective: Sink all of your opponent's ships before they sink yours.
- Setup: Each player has a grid (10x10) on which they place their ships. Ships can be placed horizontally or vertically.
- Ships: Each player has the following ships:
- 1 Carrier (5 spaces)
- 1 Battleship (4 spaces)
- 1 Cruiser (3 spaces)
- 1 Submarine (3 spaces)
- 1 Destroyer (2 spaces)
- Gameplay:
- Players take turns guessing a location on their opponent's grid.
- The opponent must announce whether the guess is a hit or a miss.
- In the case of opponent computer will automatically play
- If the guess is a hit, the opponent must also announce which ship was hit.
- The game continues until all of one player's ships are sunk.
- Setup the Board: Place your ships on your grid. Ensure they do not overlap and are within the grid boundaries.
- Start the Game: Decide who will go first.
- Take Turns: On your turn, announce a coordinate (e.g., "B5") to attack.
- Mark the Board: Mark hits and misses on your grid.
- End the Game: The game ends when all ships of one player are sunk. The player with remaining ships is the winner.
- Single-player mode against AI.
- Multiplayer mode against another player.
- Customizable grid size.
- Save and load game functionality.
- Visual representation of hits and misses.
To install and run the game, follow these steps:
- Clone the repository:
git clone https://github.com/ragul2k23/battleship
- Run the html file and enjoy the game
- If intrested add drag and drop option or any u like 💖