I am trying to make MineSweeper for a project and I am stuck on a certain part. the explode method below works fine but It seems that I cannot call the method within the method. Without posting all the code, I wanted to see if anyone knew if this is a known illegal thing in Java and/or how to bypass it.
public void explode(int row, int col) {
if(board[row][col].mCount==0 && !board[row][col].isMine()) {
for (int r = row - 1; r <= row + 1; r++) {
for (int c = col - 1; c <= col + 1; c++)
if ((r >= 0 && r < user.userRow) && (c >= 0 && c < user.userCol)) {
board[r][c].setExposed(true);
if(board[r][c].mCount == 0) {
explode(r,c); // <======= PROBLEM LINE
}
}
}
}
}
It is not giving me a compilation error, but it throws an error when I run the game.