Question
i need help on this code. it gives me the error line: at minesweeper.calculateClues(minesweeper.java:352) Line 352 is for(int c = 0; c < mines[c].length; c++){
i need help on this code. it gives me the error line: at minesweeper.calculateClues(minesweeper.java:352) Line 352 is for(int c = 0; c < mines[c].length; c++){
private void calculateClues() {
int[] arrayOfInt1 = { -1, -1, -1, 0, 0, 1, 1, 1};
int[] arrayOfInt2 = { -1, 0, 1, -1, 1, -1, 0, 1};
for(int r = 0; r < mines.length; r++){
for(int c = 0; c < mines[c].length; c++){
if(mines[r][c] == 9){
for(int t = 0; t < 8; t++){
if((validIndex(r + arrayOfInt1[t], c + arrayOfInt2[t])) &&
(mines[(r + arrayOfInt1[t])][(c + arrayOfInt2[t])] != 9)){
mines[(r + arrayOfInt1[t])][(c + arrayOfInt2[t])] += 1;// add your code here
}
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