Question: Battle functions that control the game play. After the fleet of ships is deployed, and its location is printed if desired, the game starts. The
Battle functions that control the game play. After the fleet of ships is deployed, and its location is printed if desired, the game starts. The pseudocode of the game algorithm to be implemented in main or a dedicated function is as follows.
while at least one ship is operational
invoke fire to get the location of the next shot from the user
invoke check to see if this location is occupied by a ship
if location is occupied then
invoke sink to sink the ship
report a hit
else
report a miss
Assignments
Test. Create a project titled LabTest. Add the header file battleship.hpp described above to your project. Add this file testShips.cpp to your project as well. Implement the functions prototyped in battleship.hpp file and invoked in testShips.cpp and place these function definitions in battleship.cpp
Note that presently portions of the file are commented out. This is to encourage incremental program development. You need to implement the functions that are not commented first. Then, uncomment the second portion of code and implement those functions. Once your project works correctly with all code of testShips.cpp uncommented, submit your project.
Game. Create a project titled LabGame. Use battleship.hpp battleship.cpp from the test assignment above; add game.cpp that contains main invokes the game functions declared in battleship.hpp and implements the Battleship game as described in the introduction.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
