Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

>>>>>>>>> >>>>> Board.h ------- #ifndef Board_h #define Board_h #define MAX_SIZE 24 class Board { private: static const int BEGINNER_BOARD_SIZE = 9; static const int INTERMEDIATE_BOARD_SIZE

image text in transcribedimage text in transcribed

>>>>>>>>>

image text in transcribed

>>>>>

Board.h -------

#ifndef Board_h #define Board_h

#define MAX_SIZE 24

class Board { private:

static const int BEGINNER_BOARD_SIZE = 9; static const int INTERMEDIATE_BOARD_SIZE = 16; static const int ADVANCED_BOARD_SIZE = 24;

static const int BEGINNER_MINES = 10; static const int INTERMEDIATE_MINES = 40; static const int ADVANCED_MINES = 100;

char grid[MAX_SIZE][MAX_SIZE]; int boardSize; int numMines; void initialize(); public:

//constants static const int BEGINNER_LEVEL = 1; static const int INTERMEDIATE_LEVEL = 2; static const int ADVANCED_LEVEL = 3;

Board(int level = BEGINNER_LEVEL); void print();

}; #endif /* Board_h */

Board.cpp -------

#include "Board.h" #include #include #include using namespace std; Board::Board(int level) { if(level == BEGINNER_LEVEL) { boardSize = BEGINNER_BOARD_SIZE; numMines = BEGINNER_MINES; } else if(level == INTERMEDIATE_LEVEL) { boardSize = INTERMEDIATE_BOARD_SIZE; numMines = INTERMEDIATE_MINES; } else if(level == ADVANCED_LEVEL) { boardSize = ADVANCED_BOARD_SIZE; numMines = ADVANCED_MINES; } else { boardSize = BEGINNER_BOARD_SIZE; numMines = BEGINNER_MINES; } initialize(); }

void Board::print() { for(int i = 0; i

void Board::initialize() { int mines = 0;

for(int i = 0; i

while(mines

main.cpp --------

#include #include "Board.h"

using namespace std;

int main() { //srand(time(NULL)); Board beginner; Board inter(Board::INTERMEDIATE_LEVEL); Board adv(Board::ADVANCED_LEVEL);

cout

cout

cout

}

CS 140: Object-Oriented Programming with C++ Part 2: Playing Minesweeper Classes and Random Number generation Pair Program 110 Points NAME: DATE: The user will play minesweeper by choosing either beginner, intermediate, or advanced. Once the user has selected the level of difficulty, there are two boards generated. Implement possibly 3 boards, one realBoard, one playerBoard, one board adjacentBoard. Implement the realBoard by placing the mines randomly on the board. A mine can be represented by a True value and no mine will be represented by a False value. The following is an example of a small mine. Yours will either have 9 x 9, or 16 x 16, or 24 x 24. CS 140: Object-Oriented Programming with C++ Part 2: Playing Minesweeper Classes and Random Number generation Pair Program 110 Points NAME: DATE: The user will play minesweeper by choosing either beginner, intermediate, or advanced. Once the user has selected the level of difficulty, there are two boards generated. Implement possibly 3 boards, one realBoard, one playerBoard, one board adjacentBoard. Implement the realBoard by placing the mines randomly on the board. A mine can be represented by a True value and no mine will be represented by a False value. The following is an example of a small mine. Yours will either have 9 x 9, or 16 x 16, or 24 x 24

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

Identify the hallucinogens, and describe their effects.

Answered: 1 week ago

Question

What did they do? What did they say?

Answered: 1 week ago