Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use matlab Task 3 - Minesweeper v0.1 As a warmup for Programming Assignment 2, we will try to set up the mines on the field!

use matlab
image text in transcribed
image text in transcribed
Task 3 - Minesweeper v0.1 As a warmup for Programming Assignment 2, we will try to set up the mines on the field! 1. Create a 10 x 10 random integer matrix with integers sampled between 1 and 50 and save it in variable mine field (do not reveal the field yetl) 2. Set all the elements greater than 30 in mine field to 100 and rest of the elements to 0 100 sets all the elements in A> 30 to 100. How do you set elements Hint: A(A>30) equal to or less than 30 to 0 and col respectively You can treat 100 as a mine and 0 as normal land 3. Take the input for row and column from the user and store them in the variables row 4. If you landed on a mine, you would print Boom!'. If not you would print'Safe for now'. And then you will reveal the mine field As you can see, you can play this game only once! In the next lab, we will use loops to play till we land ourselves on a mine! Below are some sample runs of this code Minesweeper vo.1 Enter ow number: Enter column number: 7 Safe for now! 0 100 0 100 0 100 0 100 100 100 0 100 0 100 o 100 00 10 0 100 100 0 100 0 100 100 100 0 100 100 0 100 0 100 100 0 100 0 100 0 100 0 100 0 100 100 100 0 100 0 100 Minesweeper vo.1 Enter row number 1 Enter column number: 1 Boom! 100 0 100 0 100 100 0 100 100 100 0 100 0 100 0 100 100 100 100 0 100 0 100 100 0 100 0 100 0 100 100 0 100 100 0 100 0 100 0 100 0 100 100 0 100 0 100 100 0 100 100 100 0 0 100 100 100 0 100 100 0 100 0 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions