Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help with this method: IN JAVA and for a Minesweeper game /** * This method sweeps the specified row and col. * - If the
Help with this method: IN JAVA and for a Minesweeper game
/** * This method sweeps the specified row and col. * - If the row and col specify a location outside the map array then * return -3 without changing the map. * - If the location has already been swept then return -2 without changing * the map. * - If there is a mine in the location then the map for the corresponding * location is updated with Config.SWEPT_MINE and return -1. * - If there is not a mine then the number of nearby mines is determined * by calling the numNearbyMines method. * - If there are 1 to 8 nearby mines then the map is updated with * the characters '1'..'8' indicating the number of nearby mines. * - If the location has 0 nearby mines then the map is updated with * the Config.NO_NEARBY_MINE character. * - Return the number of nearbyMines. * * @param map The map showing swept locations. * @param mines The array showing where the mines are located. * @param row The row, 0-based, of a location. * @param col The col, 0-based, of a location. * @return the number of nearby mines, -1 if the location is a mine, -2 if * the location has already been swept, -3 if the location is off the map. */ public static int sweepLocation(char[][] map, boolean[][] mines, int row, int col) { return -99; //FIXME
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