Skip to content

soniikot/Battleship

Repository files navigation

Battleship - Odin Project

This project is a web-based implementation of the classic board game Battleship. It is built with modern JavaScript, HTML, and CSS, and utilizes Webpack for module bundling. The primary goal of this project is to practice and demonstrate proficiency in JavaScript, DOM manipulation, and event handling.

Feautures

  • Drag and drop functionality to place ships on the board.
  • Separate boards for human and computer players.
  • Randomized ship placement for the computer player.
  • Turn-based gameplay with visual feedback for hits and misses.
  • Game over detection and display.

Technologies

  • JavaScript (ES6+)
  • HTML5
  • CSS3
  • Webpack
  • Jest

Usage

You can clone the repo on your local machine. The game starts in main.js where all components and logic are put together. Enter your name in the input field and click the "Start Game" button. Drag and drop ships from the ship container onto your board to place them. Once all ships are placed, start the game and take turns with the computer to attack each other's boards. The game will indicate hits and misses, and declare a winner when all ships of one player are sunk.