Question: JAVA, please help with this method. /** * This method initializes the boolean mines array passed in. A true value for * an element in
JAVA, please help with this method.
/**
* This method initializes the boolean mines array passed in. A true value for
* an element in the mines array means that location has a mine, false means
* the location does not have a mine. The MINE_PROBABILITY is used to determine
* whether a particular location has a mine. The randGen parameter contains the
* reference to the instance of Random created in the main method.
* Access the elements in the mines array with row then column (e.g., mines[row][col]).
* Access the elements in the array solely using the actual size of the mines
* array passed in, do not use constants.
* A MINE_PROBABILITY of 0.3 indicates that a particular location has a
* 30% chance of having a mine. For each location the result of
* randGen.nextFloat() < Config.MINE_PROBABILITY
* determines whether that location has a mine.
* This method does not print out anything.
* @param mines The array of boolean that tracks the locations of the mines.
* @param randGen The reference to the instance of the Random number generator
* created in the main method.
* @return The number of mines in the mines array.
*/
public static int placeMines(boolean[][] mines, Random randGen) {
return -99;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
