Question: Need help with a c++ program. Please print screen so at least I know the program works thanks so much . The game is very

 Need help with a c++ program. Please print screen so at

Need help with a c++ program. Please print screen so at least I know the program works thanks so much .

The game is very simple. The object of the game is to open/reveal every cell on the board without detonating a mine. Every cell contains a number or a mine. The numbers tell you how many mines surround the cell in the horizontal, vertical, and diagonal directions, e.g. at most, 8 possible mines surrounding a cell. You can flag a cell, which helps you remember where you think there is a mine to not detonate. If you select to open/reveal a cell that has a mine, then you automatically lose the game!

You will then randomly distribute the mines on the board and setup the numbers describing how many adjacent mines to each cell. After that, you will display a blank board, and ask the user to flag or open a cell on the board until the user selects a cell that contains a mine (losing the game) or selects all cells free of mines (winning the game). After the user wins or loses, you will ask the user if he/she wants to play again. If so, you must get the number of rows, columns, and mines for the new game and create a new board for a new game. BTW, you can display row and column numbers on board to make it easier to read/know which row and column to select!!!

Requirements for game:

You must provide a usage message, if the user enters incorrect command-line arguments, and they can come in any order!

You must not have functions over 15-20 lines long (-10 automatically)

You must not use global variables (-10 automatically)

You must ask the user if he/she wants to play again

o If no, then end

o If yes, then prompt for rows, cols, and mines for new game.

You must not have any memory leaks (-10 automatically)

You must detect these errors:

o Invalid row or column to flag or open o Opening a cell that has already been opened

(10 pts) Extra Credit: Recursively open all cells adjacent to 0 cell

If the user selects a cell that has no mines surrounding it, then you will help the user by recursively opening all adjacent cells to empty cells, until you reach cells with a surround mine.

a.out - 9 - 9 -m 10 Do you want to play again (1-yes, 2-no) : 1 How many rows, cols? 99 How many mines? 10 IIIIIIIIII IIIIIIIIII IIIIIIIIII IIIIIIIIII IIIIIIIIII IIIIIIIIII ||||||||| ||||||||| |||||||||| Flag (1) or Open (2): 2 Flag (1) or open (2): 1 row, col: 80 |1||||||||| IIIIIIIIII |||||||||| row, col: 63 IIIIIIIIII |1| III 111010101 ILLIL 12|010101 IIIIIIIIII ILLIL 111010101 |||||||||| TILL 13|11010101 IIIIIIIIII IIII|2|01010101 LLLLLLLLLL ILLI 12101010101 IIII!|1|01010101 |1||||||||| III |2|1|01010101 |1|||1|0101010101 Flag (1) or Open (2): 2 row, col: 55 ||||| | || || || || IIIIIIIIII IIIIIIIII IIIIIIIIII IIIIIIIIII IIIIIIIIII Flag (1) or Open (2): 2 row, col: 72 Congratulations!!! |1|1|0|1|-111010101 |*|2|1|2|2121010101 |2||2|2||1|010101 |1|1|3||3|11010101 |1|1|3||2|01010101 |1||3|2|2101010101 |1|1|2||1|01010101 Flag (1) or Open (2): 2 row, col: 0 |1|IIIIIIII IIIIIIIIII |1||1||1|0|00| |||||12|0|0|0| Flag (1) or Open (2): 2 row, col: 04 You lose!!! ------------------- |1|1||1||1|010101 |*|2|1|2|2|2|010101 121*|2|2||1|010101 |1|1|3||3|1|00|0| -------- |1|1|3|*|2|01010101 || III 1|0|0|0| TILL |3|1|0|0|0| ||||12|01010101 |1|2|3|2|1101010101 |1|* |*|10101010101 | || || | Flag (1) or Open (2): 2 row, col: 71 |1|1|011|!|1|010101 T!|2|1|2|2|2|010101 |2||2|2||1|010101 |1|1|3||3|1010101 |1|1|3||2|01010101 |1||3|2|2|01010101 |1|1|2||1|01010101 |1|2||2|1|01010101 111||10101010101 Do you want to play again (1-yes, 2-no) : 2 ||||||||| || || 12 |0|0|00| IIIIIIIIII |||||1|01010101 |1||3|2|2|01010101 |1|1|2|*|1|01010101 ----- |1|2|3|2|1|01010101 11|* |*|1|0101010101 IIIIIIIIII ---- | || |2|1|0|0|00| IIIIIIIIII IIIIIIIIII |1|||1|00|00|0|

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!