The Battleship Game

The classic board game brought to the web! Play against a simple Ai and see if you can win! Play below! https://spiffythespaceman.github.io/Battleship-Game/

Basic Rules and Gameplay

Setup Phase

  • The game starts off in set up. Your ships start off in "port". To select a ship and place it on the board, simply click one of the ships and click a square on the board on the right.
  • To deselect a ship, simply click anywhere in the port to deselect a ship.
  • Right click to rotate the ship.
  • If a ship is placed on a spot that already has a ship on it, the currently selected ship will replace the ship that is already on the board and the ship that was replaced will now be selected for replacement (Unless there are multiple ships occupying the space already)
  • The cursor will be highlighted red if a ship cannot be placed in a certain location.
  • Once all ships are placed, the ready button will now be clickable which will send the game to the attack phase.

Attack Phase

  • The game will generate random locations to place the enemy ships and it will start off as the player's turn.
  • Everytime the player makes an attack, the enemy Ai will spend a couple seconds and make a move.
  • Squares marked red indicate a hit, and squares marked white indicate a miss.
  • Anytime a ship is sunk, the player or Ai will be notified which ship was sunk and the ship will appear on the board.
  • You win when all ships have been sunk (obviously).

Future Plans

  1. Add notification for when a ship is hit or missed.
  2. Add multiple selectable themes for ships and backgrounds.
  3. Improve the AI.
  4. Add aesthetic changes.

PREVIEW

Powered by HTML, CSS, Javascript