Battleship game to demonstrate debugging.
Check out the YouTube video for full details. 👇
Run the main method inside BattleshipGame to initiate these steps:
- Setup a square board with one battleship
- Create a player
- Play the game until the ship is sunk or player runs out of turns
The battleship location is revealed at the end.
Use IntelliJ IDEA debug to solve these issues:
- Why does the board only add horizontal but not vertical battleships?
- Why do we never get message Ship sunk! when log output shows 3 direct hits?
- Why do we sometimes see
java.lang.ArrayIndexOutOfBoundsException?