The objective of this assessment is to test your understanding of all the topics covered in this component. It covers the following learning outcomes:
Battleship, designed by Clifford Von Wickler but patented by Milton Bradley Company in 1943, is a classic board game that has been adapted into multiple formats over the years, including video games. In this summative, you will design and implement a program that replicates the Battleship game in C++.
The game is played on a set of four 10x10 grids, two for each player. On one of the grids, the player arranges the position of their ships and records shots made by the opponent. On the other grid, the player records their own shots that they have taken at the opponent. Each player has five ships of varying lengths, as follows:
Type of Ship | Size (Length) |
Aircraft Carrier | 5 |
Battleship | 4 |
Destroyer | 3 |
Submarine | 3 |
Patrol Boat | 2 |
Figure 1: Ship types and lengths.
Before the game starts, each player arranges their ships on their grid, ensuring that the opponent does not know the position of the ships. No parts of any ships may overlap each other.
The game-play proceeds in a turn-based manner. In each turn, the player announces a grid position, identified by a letter and a number coordinate, that they will fire upon. If an opponent ship occupies the identified grid position, then the ship takes a hit in that square. The opponent then announces to the player if the player has scored a hit or not. A ship sinks when the ship is hit in all squares that it is occupying. When a player sinks all of the opponent's ships, the game ends and the player wins. This version of the game must have a graphical representation of both game boards of a player (a board representing the players ships and a board representing the players misses and hits at the opponent).
The game-play must be implemented as per the description under the Game-play and Rules section. Game-play must be bug free.
The game setup phase must allow the player to set up the ships' positions via one of two options:
Both of the above options must be implemented.
There is to be only one game mode, single player, which allows one human player to play head- to-head with the computer AI. The AI does not need to be complex, but must be functional to allow an interactive game of Battleship.
A summary of the game must be displayed when a game is over, clearly identifying the winner.
The game must provide a Debug mode that displays the positions of the Computer's ships on the grid in game. The debug mode must be accessible from the main menu screen.
The source code is required to display the following features:
The source code is required to display the following features:
The executable is required to provide an intuitive interface with the following features:
Extra features may be included in the implementation if desired, as long as the base game-play is still Battleship as specified above. Ensure the extra features enhance the quality of the game, rather than detracting from the submission.