THIS IS IN MATLAB, I NEED A CODE FOR A SIMPLE MINESWEEPER GAME I DONT KNOW HOW TO BE ANY CLEARER
1. Create a figure with the various controls arranged in an appropriate fashion paying aRen1on to func1on AND aesthe1c; 2. In the setup, create a field of buttons; the size of the field is provided by the user; 3. A user specified number of mines are to be randomly placed and hidden within the field; 4. A buRon will close the window (ending the game) a[er revealing all of the mines and displaying the 1me to complete the game; 5. An buRon will provide the authors name in addi1on to a summary of how to play (use) the game (including the goal); 6. Provide some means for the user to get a hint as to a safe place to start/play; 7. Provide some means to flag (i.e., disable) a mine; 8. When a square is cleared, the number of neighboring mines is displayed in the square; 9. Indicate the probability of a mine being present; That is, show the ra1o of uncleared mines to uncleared squares 10. The users progress toward the goal will be displayed; 11. To assist with grading, provide the means (i.e., a buRon) to reveal all of the mines during play so that the instructor can easily determine the correctness of the calcula1ons. This will also help you to test your code.
CISC 130 Lab #5 - Minesweeper - Introduction This Lab should be completed by each student, individually. That is, devise a solution of your own and then implement it. In this lab, in addition to the Matlab programming that you have already learned, and the usual problem solving, you will create a variety of functions to implement a minesweeper game. You will make calculations based on subsets of data created with user inputs and random numbers. The Lab Setup The following steps will help you set up the lab. 1. In your OneDrive\CISC130 folder, using Matlab, create a new file LabM5_mine.m 2. Put a comment at the top, listing yourself as the author. Activities Today, you are going to create an interactive Minesweeper game where the object is to clear the field of (randomly placed) mines. The "rules" are: . This is a solitaire game (one player); . . clicking on a square containing a mine reveals (1.e., "explodes") the mine; clicking on an "empty" square clears the square and reveals the number of mines adjacent to the square (a.k.a., provides a clue); There are several alternatives as to the endgame; revealing all of the mines; revealing all of the empty squares; clearing a path through the field; etc. You may implement any so long as you are able to determine the end of the game. 4.03 Implementation The code will need to do the following using a variety of functions. 1. Create a figure with the various controls arranged in an appropriate fashion paying attention to function AND aesthetic; 2. In the setup, create a field of buttons; the size of the field is provided by the user; 3. A user specified number of mines are to be randomly placed and hidden within the field; 4. A
button will close the window (ending the game) after revealing all of the mines and displaying the time to complete" the game; 5. An button will provide the author's name in addition to a summary of how to play (use) the game (including the goal); 6. Provide some means for the user to get a "hint" as to a safe place to start/play; 7. Provide some means to "flag" (i.e., disable) a mine; 8. When a square is "cleared, the number of neighboring mines is displayed in the square; 9. Indicate the probability of a mine being present; That is, show the ratio of uncleared mines to uncleared squares 10. The user's progress toward the goal will be displayed; 11. To assist with grading, provide the means i.e., a button) to reveal all of the mines during play so that the instructor can easily determine the correctness of the calculations. This will also help you to test your code. Submittal Submit the file LabM5_mine.m through Canvas. Addendum Remember that, in general, a function has the form = function_name (inputs) function (outputs] * body end A function that returns two variables has the form function (output1, output2] = function_name2 (inputs) #body outputi something'; output2 something else'; end = = To call a function that returns two variables you may [A, B] = function_name2 (input_data) Also, remember that a function that is called from a uicontrol has at least two calling arguments function function_name (handle, event, other_inputs_as_needed) & body end The uicontrol callback for an internal function is of the form control name. Callback = {@function_name, other_inputs_as_needed}