Skip to content

A oceanic battle game developed using TDD where players take turns firing shots into enemy waters

Notifications You must be signed in to change notification settings

jonslui/battleship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo: https://jonslui.github.io/battleship/dist/index.html

Battleship

A turn-based strategy game where players take turns firing shots into enemy waters. The first one to destroy all enemy ships wins.

When planning this project, my goal was to gain experience using Jest and Test Driven Development while keeping my player, gameboard, and ship factories as pure as possible. This was my first time using TDD on something larger than small practice problems, and it was a great feeling how everything came together cleanly at the end.

To keep the game competitive, I added 'intelligent' decision-making to the AI. If the AI player hits a tile, it will search the 4 adjacent tiles before beginning to randomly search the waters again.

Goals for completing this project

  1. Practice using Jest (tests found in src/factories folder).
  2. Gain experience using TDD.
  3. Practice creating modular code and keeping functions pure.

Usage

  1. Click this link: https://jonslui.github.io/battleship/dist/index.html or download files and open index.html in a browser of your choice.
place.ships.and.launch.attack.mov
  1. Drag and drop your ships.
  2. Click a tile on the opponent's board to attack (red means hit, white means miss).
Sink.a.ship.mov
  1. Hit all tiles of an opponent's ship to destroy it.
End.game.and.start.again.mov
  1. The first player to destroy all their opponent's ships wins

  2. Click "New Game' to play again.

  3. Enjoy!

About

A oceanic battle game developed using TDD where players take turns firing shots into enemy waters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published