Question: MATLAB. Please write a code that creates a playable Minesweeper game in MATLAB. Thank you CISC 130 Lab #5 - Minesweeper Introduction This Lab should

MATLAB. Please write a code that creates a playable Minesweeper game in MATLAB. Thank you

MATLAB. Please write a code that creates a playable Minesweeper game inMATLAB. Thank you CISC 130 Lab #5 - Minesweeper Introduction This Labshould be completed by each student, individually. That is, devise a solution

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 (l.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. 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 (outputs] = function_name (inputs) % 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}

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!