/battleship

Battleship game created for The Odin Project JS Curriculum

Primary LanguageJavaScript

Battleship

Purpose

This Battleship project was part of my self-guided education through The Odin Project JS Curriculum. The intention of this was to practice the basics of testing using Jest, while also refining my skills with React.

Some of the challenges, aside from learning Jest, included using object-oriented paradigms alongside of React state-management good practices. If I started this project again, I would devise a cleaner way of handling the state of the game either by making the object data completely immutable or making the game logic decoupled from the local react state by using context and reducer actions.

Another challenge was handling and rendering the SVG components correctly, in particular, flipping them for y-axis ship alignments.

Devising a clever algorithm for the AI to play like a human was the final challenge, and one that proved to take more time than I anticipated. However, it was probably the most fun and reward aspect of this project.

Features:

  • Interactive browser-based game akin to the Hasbro™ board game.
  • Smart AI that plays similarly to a human (does not "cheat")
  • Satisfying naval sound effects and war music to pump you up