https://fadingmorsecode.github.io/battleship/
- Begin by clicking on start game button
- Drag ships to your desired location and orientation. Placement is based on the location of the cursor and not the draggable ship itself.
- Start attacking! Missed attacks are white and hits are red. Sunken ships will appear black with a skull and bones.
- The game will end and announce the winner when all ships have been sunk on a playerboard.
This is an implementation of the classic strategy game called battleship. Players strategicially attack their opponents in an attempt to sink all of their enemy's ships. My version of the game is played against a computer that randomly chooses its ship placements and randomly attacks the player's board.
- Practice test driven development using jest
- Should have a
hit()
function that increases the number of ‘hits’ on a ship -
isSunk()
should be a function that calculates whether a ship is considered sunk based on its length and the number of hits it has received. - Gameboards should be able to place ships at specific coordinates by calling the ship factory function
- Gameboards should be able to receive attacks, keep track of missed attacks, and report whether or not all of their ships have been sunk
- Each player object should contain it’s own gameboard.
- Event listeners should step through the game turn by turn
- Make the ‘computer’ players capable of making random plays.
- Create conditions so that the game ends once one player’s ships have all been sunk.
- Implement a system that allows players to place their ships.
- Drag and Drop via HTML Drag and Drop API
- Create a 2-player option that lets users take turns by passing the device back and forth
- Polish the intelligence of the computer player by having it try adjacent slots after getting a ‘hit’