Question: >>>>>>>>> >>>>> 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

 >>>>>>>>> >>>>> Board.h ------- #ifndef Board_h #define Board_h #define MAX_SIZE 24class 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

>>>>>

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!