Question: Minesweeper. Write a program that takes three command-line arguments m, n, and p and produces an m-by-n boolean array where each element is occupied with
Minesweeper. Write a program that takes three command-line arguments m, n, and p and produces an m-by-n boolean array where each element is occupied with probability p. In the minesweeper game, occupied cells represent bombs and empty cells represent safe cells. Print out the array using an asterisk for bombs and a period for safe cells. Then, create an integer two-dimensional array with the number of neighboring bombs (above, below, left, right, or diagonal).
Write your code so that you have as few special cases as possible to deal with, by using an (m2)-by-(n2) boolean array.
. * ** 100 3 3 200 1 * 100
Step by Step Solution
3.32 Rating (167 Votes )
There are 3 Steps involved in it
To solve the Minesweeper problem we need to write a program that generates an mbyn boolean array whe... View full answer
Get step-by-step solutions from verified subject matter experts
