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 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
void Board::print() { for(int i = 0; i
void Board::initialize() { int mines = 0;
for(int i = 0; i
while(mines
main.cpp --------
#include
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started