<robeecodes />

Battleship

Play the classic Battleship game online against a computer. Built to demonstrate advanced interactive techniques with Javascript, as well as the Jest testing framework.

Type: Personal – The Odin Project | Technologies: HTML, CSS, Javascript, Jest, Webpack, Object-Oriented Programming

Live Demo | GitHub Repository

Executive Summary

Battleship is a web-based implementation of the classic board game where players can randomise their board layout and play against the computer. Key features include:

  • Basic CPU player AI which will randomly target squares until it hits a player ship. It will then try adjacent tiles to the successful hit.
  • Randomise board layouts: instead of manually laying out the different ships, players can randomly generate valid board layouts to get started quickly.
  • Jest framework was used to rigorously test the different game objects.

Key Takeaways

  • Test-driven development can make development much easier by catching any issues as they're introduced to the project.
  • Computer players can be created by determining an algorithm for gameplay

Purpose and Goal

This project was created as a task for The Odin Project to help practice and demonstrate skills in test-driven development.

Back to Projects