Question: C BATTLESHIP PROGRAM The program will simulate a one player version of the classic game Battleship. The goal of this version is to sink all
C BATTLESHIP PROGRAM
The program will simulate a one player version of the classic game
Battleship. The goal of this version is to sink all 5 ships using the least
number of missiles.
The game is played on a 10 x 10 grid. The columns of the grid will be
labeled A, B, C, D, E, F, G, H, I, and J. The rows of the grid will be
numbered 1 10.
The 5 ships will be randomly placed on the game board. Neither the
programmer or the user will have any idea where the ships have been
placed. The ships can be placed vertically or horizontally. All ships must
be located within the 10 x 10 grid.
Game Play
The user will select a row and column combination and fire a missile. If the
missile hits a ship the grid will display the letter H to indicate a ship was
hit. The user will continue to fire missiles until all ships have been sunk.
Once a ship has been sunk, the Hs will be replaced by the letters that
represent the ship that has just been sunk.
Cruiser
= 2 holes = C
Submarine
= 3
holes = S
Destroyer
= 3 holes = D
Battleship
= 4
holes = B
Aircraft Carrier
= 5 holes = A
As the game is played, some where on the screen the user will see how
many missiles that have been fired. The name of each ship that is still
floating and the name of each ship that has been sunk.
Other Rules
The game will have an option to display the past 10 best scores, therefore
it will store the top best scores (lower score the better).
You will allow the user to see the top 10 scores.
You will allow the user to play the game.
You will allow the user to quit the game.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
