Hello. I am in desperate need of help for a school project. It is due today at 11:59pm CDT. I genuinely do not even know where to begin.
Lab Description : Ben loves Kitties and his kitties are running free. You need to help Ben identify where his kitties are so he can get them all rounded up.
Each cell in the boolean matrix that contains a kitty will be set to true. Each cell that contains no kitty will be set to false. Use Math.random() to randomly place the 0s and 1s in the grid – try multiplying by numbers larger than 2 if you want fewer kitties in the grid.
As you work to help Ben recover his lost kitties, you will create an integer matrix that stores the number of kitties near each cell. Each cell that contains a kitty is set to 9. All other cells are set to the value of how many kitties are around them. This integer grid will be used to determine the best location from which to start collecting Ben’s kitties.
Bonus Challange: Write a method to find the best place to drop a kitty collecting robot. The robot will fan out in all directions and collect all kitties within a 3 cell radius. Your method should return the location of the best place to drop the robot.
Boolean matrix(all random)
0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1
0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 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 0 1 1 1
0 0 0 0 0 0 1 1 1 0 0 0 3 9 4 1 1 1 9 2
0 0 0 1 1 1 1 1 2 1 1 0 2 9 3 9 1 1 2 9
0 0 0 1 9 1 1 9 3 9 3 2 2 2 2 1 1 0 1 1
0 0 0 1 1 1 2 2 4 9 9 3 9 1 0 0 0 0 0 0
0 1 1 1 0 0 2 9 3 3 9 5 3 2 0 0 0 0 0 0
1 2 9 1 0 0 2 9 2 1 2 9 9 1 0 0 0 0 1 1
1 9 2 1 0 0 1 1 1 0 1 2 3 2 1 0 0 0 1 9
1 1 1 0 0 0 0 0 0 0 1 1 2 9 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 1 9 2 1 1 1 9 1 1 1
0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 1 1 9
0 0 0 0 1 1 2 9 1 0 1 1 2 1 1 0 0 0 1 1
0 0 0 0 2 9 3 1 2 1 2 9 2 9 1 0 0 0 0 0
0 0 1 1 3 9 2 1 2 9 2 1 2 1 1 0 0 0 0 0
0 0 2 9 3 1 2 2 9 2 1 0 0 0 0 0 0 0 0 0
1 1 2 9 2 0 1 9 2 1 0 0 0 0 0 0 0 0 0 0
9 1 1 1 1 0 1 1 1 0 0 1 1 2 1 1 1 1 1 0
1 1 0 0 0 0 1 1 1 1 1 2 9 4 9 2 1 9 1 0
Here is what is in Main.java:
Here is what is in KittyMap.java:import java.io.File; import java.io.IOException; import java.util.Scanner; import static java.lang.System.*; class Main { public static void main(String[] args) { KittyMap km = new KittyMap(10, 10); System.out.println( km + "\n\n"); km.printKittyCount(); } }
import java.util.Scanner; import static java.lang.System.*; public class KittyMap { private boolean[][] kittyGrid; /* *this constructor loads in random true and false values */ public KittyMap(int rows, int cols) { } /* *this method will call getKittyCountsGrid *to retrieve the kitty counts for the kittyGrid */ public void printKittyCount() { } /* *this method will calculate the kitty counts for each cell *if cell is true set int value to 9 *if cell is not true set int value to cnt of kitties in adjacent cells */ private int[][] getKittyCountsGrid() { return null; } /* *this method will return the value of the current cell *if this cell contains a kitty - return 9 *otherwise - return the cnt of all kitties in adjacent cells */ public int getKittyCount( int r, int c) { return 0; } /* *check r and c to ensure they are inside the grid */ private boolean inBounds( int r, int c) { return false; } /* *return the kitty grid as a string */ public String toString() { String output=""; return output.trim(); } }