MATLAB minesweeper function solBoard = markSquaresAdjTomines(solBoard) % Inputs: solBoard is a 2D array of integers in the range [0-9] & [11-13] % that represents the state of the player's board,...


MATLAB minesweeper


function solBoard = markSquaresAdjTomines(solBoard)


% Inputs: solBoard is a 2D array of integers in the range [0-9] & [11-13]


% that represents the state of the player's board, where


% 0: empty square


%1-8: Squares with digits 1 to 8


% 9: mine square


% 11: unrevealed square (square that is still flipped over)


% 12: flagged mine square (player thinks there is mine a this square)


% 13: exploded mine square (player picked a mine square)


% Returns: solBoard is MODIFIED so that all adjecent squares to the mine


% squares are marked with the correct digits b/n 1-8



function sol Board - marksquaresAdj ToMines (solBoard) Inputs: solBoard is a 2D array of integers in the range (0-9) 6 (11-13) that represents the state of the player's board, where 0: empty square 1-8: squares with digits 1 to 8 9:mine square 11: unrevealed square (square that is still flipped over) 12: flagged mine square (player thinks there is mine a this squa 13: exploded mine square (player picked a mine square) Returns: sol Board is MODIFIED so that all adjacent squares to the mine squares are marked with the correct digits b/n 1-8 Here is an example run of this function. Use this to test your function. >> sol Board solboard - 0 0 0 0 0 0 0 0 >> solBoard - marksquaresAd ToMines (solBoard) solBoard - 0 1 1 1 1 0 0 0 The adjacent squares to the mines are updated to show a digit that shows how many mines are adjacent 0 1 0 1




May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here