(Solved) : Write Random Game Use C Program Write Program Q42783658 . . .

This program requires you to write a game called Mine ( E S ). Mine game has the following rules: 1. There is a NxN grid. 2.

How to write this random game? I have to use c program to writethis program

This program requires you to write a game called Mine ( E S ). Mine game has the following rules: 1. There is a NxN grid. 2. Mine randomly selects M cells as the hidden mines. 3. Players do not know where are the hidden mines. 4. Then player starts to select a cell. If he is lucky, a number K will be printed on that cell, where K is the number of mines surrounding the cell. Otherwise, if the cell has a mine then it will explode and game over. 5. Player can repeat the guessing process. Finally the mine game will give the player a ” you win” or “you are dead” message and the game is over. In your program, you need meet the following requirements: 1. Run the program as “mine N M”, N is the size of the map and M is the # of mines, and mine is the program executable name, by using command argument. 2. Write a input function that can get the player’s input guess from keyboard. 3. These M mines are placed in the grid randomly by using random number generator. 4. Write a function to compute the number of mines encompassing a cell. 5. Write a output function that will output the grid with correct numbers associated with cells. 6. Use a clear screen function like system(“clear”); 7. #define Nmax 30 to see the size of the grid as NxN. So, if your input number N is greater than Nmax, your program should output an error message to indicate n is too large. 8. You must use array pointers instead of array subscripts to access the array elements. Show transcribed image text This program requires you to write a game called Mine ( E S ). Mine game has the following rules: 1. There is a NxN grid. 2. Mine randomly selects M cells as the hidden mines. 3. Players do not know where are the hidden mines. 4. Then player starts to select a cell. If he is lucky, a number K will be printed on that cell, where K is the number of mines surrounding the cell. Otherwise, if the cell has a mine then it will explode and game over. 5. Player can repeat the guessing process. Finally the mine game will give the player a ” you win” or “you are dead” message and the game is over. In your program, you need meet the following requirements: 1. Run the program as “mine N M”, N is the size of the map and M is the # of mines, and mine is the program executable name, by using command argument. 2. Write a input function that can get the player’s input guess from keyboard. 3. These M mines are placed in the grid randomly by using random number generator. 4. Write a function to compute the number of mines encompassing a cell. 5. Write a output function that will output the grid with correct numbers associated with cells. 6. Use a clear screen function like system(“clear”); 7. #define Nmax 30 to see the size of the grid as NxN. So, if your input number N is greater than Nmax, your program should output an error message to indicate n is too large. 8. You must use array pointers instead of array subscripts to access the array elements.

Expert Answer


Answer to How to write this random game? I have to use c program to write this program…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?