Question: Minesweeper Programming challenge description: You will be given an M * N matrix. Each item in this matrix is either a ' * ' or
Minesweeper
Programming challenge description:
You will be given an MN matrix. Each item in this matrix is either a or a A indicates a mine, whereas a does not. The objective of the challenge is to output a MN matrix where each element contains a number except the positions which actually contain a mine which will remain as which indicates the number of mines adjacent to it Notice that each position has at most adjacent positions eg left, top left, top, top right, right,
In the first sample test case, the matrix:
becomes
Input:
Your program should read lines from standard input. Each line contains MN a semicolon and the MN matrix in row major form.
Output:
Print out the new MN matrix in row major form with each positionexcept the ones with the mines indicating how many adjacent mines are there.
Test
Test InputDownload Test Input
;
Expected OutputDownload Test Output
Test
Test InputDownload Test Input
;
Expected OutputDownload Test Output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
