The Project will be a simplified version of the classic game of Battleship. You
ID: 3535179 • Letter: T
Question
The Project will be a simplified version of the classic game of Battleship. You will have two six by six grids on which you will place two adjacent 0’s. The computer will also select locations for the two adjacent 0’s on the second grid but will not display them. Then you and the computer will alternately guess the location of the 0’s on the other grid. The winner will be the side that guesses the location first.
We will NOT use a graphics library for this project; rather we will animate ASCII art. I will explain how to do this in class.
Explanation / Answer
#include #include #include #include #include const int empty = 0; // contains water const int occupied = 1; // contains a ship const int missed = 2; // shot into ocean const int hit = 3; // shot and hit using namespace std; int board[ 10 ][ 10 ]; // Two-dimensional array for gameboard. void initialize_board( int array1[ 10 ][ 10 ] ) // Function to initialize the gameboard. { // create a blank board for (int x=0; xRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.