Question
Implement a method setHints (below) that accepts a 2 dimensional array of integers containing - 1s and 0s and modifies it according to the following
Implement a method setHints (below) that accepts a 2 dimensional array of integers containing - 1s and 0s and modifies it according to the following (minesweeper) criteria: to hint of its presence, for each mine (a value - 1) increment by 1 the value of all its surrounding squares ; if another mine exists in one of these squares, its value is left unchanged.
public static void setHints(int[][] array){
//Your code here
}
The figure below illustrates the state of an array at the beginning of the method (left) and at the end of the method (right) after all the hint values have been added.
JUnit Tests
Each method above will be tested with JUnit test cases. It will will be discussed in class. These JUnit test cases are complete and should not be modified. In addition, your programs should not hard-code any answers.
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