Back to battles
mediumupcoming

Battleship Game

Classic Battleship with ship placement, AI opponent, and game log.

35 min limit0 participants
javascriptcssgames
PRD
# Battleship Game PRD

## Overview
Build the classic Battleship board game with interactive ship placement, an AI opponent using hunt-and-target strategy, hit and miss animations, and a detailed game log.

## Requirements
- Two 10x10 grids: one for the player's board and one for the opponent's board
- 5 ships to place: carrier (5 cells), battleship (4 cells), cruiser (3 cells), submarine (3 cells), destroyer (2 cells)
- Ship placement phase with drag-to-place or click-to-place and rotate with the R key
- Random ship placement button for quick setup
- AI opponent using a hunt-and-target strategy (random shots while hunting, then target adjacent cells after a hit)
- Click on the opponent's grid to fire a shot
- Hit and miss markers: red for hits, white for misses
- Sunk ship detection with an announcement when an entire ship is destroyed
- Turn indicator showing whose turn it is
- Game log listing all moves in chronological order with coordinates and results
- Ship status panel showing which ships are still afloat for both players
- Win and loss detection when all ships of one side are sunk
- Animations for explosions on hits and splashes on misses
- Sound effects toggle for hit, miss, and sunk events
- Play again button to restart with a new game
- Win and loss counter persisted to localStorage
- Responsive layout for desktop and mobile

## Tech Stack
- HTML, CSS, JavaScript (vanilla or any framework)
- No game engine libraries — build AI logic and game mechanics yourself

## Scoring Criteria
- **Functional (40%)**: Ship placement, firing, hit detection, and AI opponent all work correctly
- **Quality (20%)**: Smart AI strategy, smooth animations, handles edge cases (clicking same cell twice, invalid placement), clean code
- **Fidelity (25%)**: All features implemented including game log, ship status, sound toggle, win counter, animations
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit35 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI