Не проходит 3-5 условие, код весь вроде внимательно просмотрел и не понимаю, в чем ошибка. Помогите пожалуйста
package com.javarush.games.minesweeper;
import com.javarush.engine.cell.*;
import java.util.*;
public class MinesweeperGame extends Game {
private static final int SIDE = 9;
private GameObject[][] gameField = new GameObject[SIDE][SIDE];
private int countMinesOnField = 0;
public void initialize() {
setScreenSize(SIDE,SIDE);
createGame();
}
private void createGame() {
int k = 0;
for(int i = 0;i < SIDE;i++) {
for(int j = 0;j < SIDE;j++) {
if(getRandomNumber(10) == 1) {
countMinesOnField++;
gameField[j][i] = new GameObject(i,j, true);
}
else
gameField[j][i] = new GameObject(i,j,false);
setCellColor(j,i,Color.ORANGE);
}
}
}
private void countMineNeighbors() {
List<GameObject> collectionNeighbors;
for(int i = 0; i < SIDE;i++) {
for(int j = 0; j < SIDE;j++) {
if(!gameField[j][i].isMine) {
collectionNeighbors = getNeighbors(gameField[j][i]);
for(GameObject obj : collectionNeighbors) {
if(obj.isMine)
gameField[j][i].countMineNeighbors++;
}
}
else
continue;
}
}
}
private List<GameObject> getNeighbors(GameObject gameObject) {
List<GameObject> result = new ArrayList<>();
for(int i = gameObject.y - 1; i < (gameObject.y + 1);i++) {
for(int j = gameObject.x - 1; j < (gameObject.x + 1);j++) {
if(gameField[j][i] == gameObject)
continue;
if(i < 0 || i >= SIDE)
continue;
if(j < 0 || j >= SIDE)
continue;
result.add(gameField[j][i]);
}
}
return result;
}
}