Skip to content

soloiaros/battleships

Repository files navigation

⚓ Battleships

A modern, responsive, and interactive Battleships game built with Vanilla JavaScript and SCSS. Test your tactical skills against an AI opponent in this variation of the classical Battleship game.

✨ Features

  • Strategic Gameplay: Classic 10x10 grid combat with intuitive ship placement.
  • Modern UI: Responsive layout with smooth animations and nice hover effects.
  • Theme Support: Fully integrated Light and Dark modes.
  • Dynamic Feedback: Visual indicators for hits, misses, and sunken ships.
  • Smart Boarding: Automatic marking of surrounding areas once a ship is confirmed sunk.

📸 Screenshots

Ship Placement In-Game Action
Initial Placement Game Process
Alforitm for random placement of ships Game process - buffer zones around ships automatically fill up

🚀 Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm (v6 or higher)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/battleships.git
    cd battleships
  2. Install dependencies:

    npm install

Development

Run the development server with Hot Module Replacement:

npm run serve

Production Build

Create an optimized bundle in the dist/ folder:

npm run build

🛠️ Built With

  • JavaScript (ES6+) - Core logic and game state management.
  • Sass (SCSS) - Advanced styling and theme management.
  • Webpack - Module bundling and asset optimization.
  • Jest - Comprehensive unit testing for game mechanics.
  • Babel - JavaScript transpilation for cross-browser compatibility.

🧪 Testing

The project uses Jest for automated testing of the Ship and Gameboard classes.

npm test

About

🚢 Battleships: A sleek, modern browser-based simulation of the classic maritime combat game. Features a responsive 10x10 grid, intuitive drag-and-drop ship placement, smart AI logic, and a refined UI with full light/dark mode support

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors