Battleship with Autogeneration option for placement of ships

Created Battleship inside of terminal!

I made my Battleship game 1 player with the opponent being the pc.

The hardest feature to implement was the randomization of the ship placement that would randomize both the location and the orientation of the ships when this option was selected. It also makes sure that all of the ships placed are valid as in none are overlapping or going past the board.

The board size is modifiable with 8, 9, 10 being the standard sizes that are present in the game however, any number of sizes would technically work as long as the letters list contains enough char values.

Check it out here!

1 Like