Question
MATLAB minesweeper function solBoard = markSquaresAdjTomines(solBoard) % Inputs: solBoard is a 2D array of integers in the range [0-9] & [11-13] % that represents the
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 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 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started