
Battleships
C++
1
8 weeks
‘Create a text based variation of the classic Battleships game entirely in the command console’
First Year Trimester 2 University Project
Grade awarded: A
Procedural generation
Grid Generation
Both the player and enemy grid generate procedurally using ASCII characters. The grid dimensions are customisable allowing for any size grid.
This generation is an iteration on the UI panels used to create the game panels in my C# STL project, and produces a clean commercially viable look.
A*
Gameplay
When the game begins the player selects where to place the ship by inputting the orientation and the coordinates.
If the player does not place the ships and tries to begin the game will prompt the player to place ships and can randomly place any unplaced ships.
A difficulty setting is chosen which affects the AI strategy
Easy - enemy completely randomly choses its attack coordinate each turn
Medium - enemy randomly chooses coordinate each turn, if a ship is hit it tries to discover remaining parts of the ship
Hard - enemy systematically attacks coordinates, then tries to discover remaining ship parts on hit
OOP, pointers, header files
Under the hood
This module helped introduce usage of header files, pointers, and we started learning about memory allocation.