Now, I want you to add the following steps as it mentioned to complete the game
ID: 3825525 • Letter: N
Question
Now, I want you to add the following steps as it mentioned to complete the game
finelude sia aerea.no include catdlib f include cetime using namespace atda f define MINEBOARD3 12E S //Enumen rator symbola enum aymbola ATTHERATE 64 Zero 4B THREE FIVE BIX EIGHT 1; //Method to atart the game board void start (aymbola 4minea, int n) for (int vi 0, vi ng vi) lvij for int vj mine alvillvj] (symbols) (42) //Method to assign mine to a unique space bool assignatine (symbol 6mines, int n) bool unique alae: while unique) int rand na int y rand if (mine [x] tyl ymbola (42)) unique true; mine atx]ly] Caymbola) (64) return true //Method to display the mine board void display ymbola mines, int n) cout for (int vi 0; vi na ++vi cout
Explanation / Answer
prgrm.h consists of portion of program from include statement to before mainfunction starting
main.cpp includes main function and include statement of file prgrm.h
func.cpp include function definition.
your code is image so it is not feasible to copy in three different files.
2. class Grid {
public:
bool has_bomb, marked;
Grid(void) {
has_bomb = false;
marked = false;
}
};
for (int y = 0; y < sizey; y++)
{void drawBoad(Grid board[sizex][sizey])
{
// _0_1_2_3_4_5_6_7_8_9_
// 0|_|_|_|_|_|_|_|_|_|_|
// 1|_|_|_|_|_|_|_|_|_|_|
// 2|_|_|_|_|_|_|_|_|_|_|
// 3|_|_|_|_|_|_|_|_|_|_|
// 4|_|_|_|_|_|_|_|_|_|_|
// 5|_|_|_|_|_|_|_|_|_|_|
// 6|_|_|_|_|_|_|_|_|_|_|
// 7|_|_|_|_|_|_|_|_|_|_|
// 8|_|_|_|_|_|_|_|_|_|_|
// 9|_|_|_|_|_|_|_|_|_|_|
//This draws the top line
cout << " _";
for (int i = 0; i < sizex; i++)
{
cout << i << "_";
cout << y << "|";
for (int x = 0; x < sizex; x++)
{
if (board[x][y].has_bomb && board[x][y].marked)
{
cout << "!|";
}
if (board[x][y].has_bomb)
{
cout << "b|";
}
else if (board[x][y].marked)
{
cout << "x|";
}
else
{
cout << "_|";
}
}
cout << endl;
}
}
int main()
{
lose = false;
bomb_count = 15;
checkx = 0;
checky = 0;
Grid gameboard[sizex][sizey];
for (int i = 0; i < bomb_count; i++)
{
int xpos = rand() % 10;
int ypos = rand() % 10;
if (gameboard[xpos][ypos].has_bomb == false) {
gameboard[xpos][ypos].has_bomb = true;
}
else
{
i--;
}
}
drawBoad(gameboard);
cout << endl;
while (lose != true)
{
cout << "Input x grid to check." << endl;
cin >> checkx;
cout << endl << "Input y grid to check." << endl;
cin >> checky;
if (gameboard[checkx - 1][checky - 1].has_bomb == true) {
cout << "Boom!";
lose = true;
}
else {
cout << "Try again." << endl;
}
gameboard[checkx - 1][checky - 1].marked = true;
cout << endl;
drawBoad(gameboard);
cout << endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.