Question: GIVEN MATRIX IN MATLAB: [0 , 1 , 1 , 0 ; 1 , 0 , 0 , 0 ; 0 , 0 , 0

GIVEN MATRIX IN MATLAB: [0 , 1 , 1 , 0 ; 1 , 0 , 0 , 0 ; 0 , 0 , 0 , 1 ; 1 , 0 , 0 , 1]

Should look like this:

0 1 1 0

1 0 0 0

0 0 0 1

1 0 0 1

The point of the code is to be like minesweep WITHOUT the game layout, just and input and output in matlab. The MATLAB code should ask the user to input a Matrix with 0's and 1's. 0 being NOT a bomb and 1's being a bomb. The code then should read the matrix of 0's and 1's and out put the following code:

2 2 1 1

1 2 3 1

2 1 2 1

0 1 2 1

Basically, the code should read the matrix at every point bomb or no bomb. Then the code should check the surrondings for a bomb: up, down, left, right, and diagnal, and put how many bombs are around that location. If that point in the matrix is a bomb its self it does not count itself. As shown in the previous code.

Thank you

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!