Home/Projects/Battleship
Shipped
Web DevelopmentGame Development

Battleship

A classic grid-based strategy game implemented in vanilla JavaScript, demonstrating DOM manipulation, event-driven game state management, and a hunt-and-target AI opponent.

recruiter perspective

Battleship game with hunt-and-target AI in vanilla JavaScript

  • ›Fully playable browser game with drag-and-drop ship placement
  • ›Hunt-and-target AI with directed search after first hit
  • ›Clean separation between game logic and DOM rendering
Play live
Hiring Summary

A browser-based Battleship game with AI opponent, drag-and-drop ship placement, and animated attack sequences. Built in vanilla JavaScript to practice DOM manipulation and event-driven state management.

Implement a fully playable browser-based Battleship game with an AI opponent as a JavaScript fundamentals project.

Challenges Addressed
  • No external libraries — vanilla JS, HTML, CSS only
  • AI opponent must use hunt-and-target behavior, not just random shots
  • Ship placement must support drag-and-drop and rotation
◆BattleshipWEB DEVELOPMENT/visual-placeholder

Vanilla JavaScript with module separation between game logic (ship placement, attack resolution, win detection), DOM rendering (grid generation, cell state updates), and AI (random hunt phase → directed target phase after first hit).

Stack
JavaScriptHTMLCSS
Decision
Separate game logic from DOM rendering
Keeping game state in a pure logic module makes it testable and reusable without touching the DOM.
Tradeoff
AI complexity vs. implementation scope
Chose: Hunt-and-target heuristic
Hunt-and-target (random until a hit, then search adjacent cells) provides noticeably better-than-random play with straightforward implementation.
01Probability density AI for optimal play
02Two-player mode over WebSocket
03Mobile touch support for ship placement