please help me
package com.codegym.games.minesweeper;
import com.codegym.engine.cell.Color;
import com.codegym.engine.cell.Game;
import java.util.ArrayList;
import java.util.List;
public class MinesweeperGame extends Game {
private static final int SIDE = 9;
private GameObject[][] gameField = new GameObject[SIDE][SIDE];
private int countMinesOnField;
private static final String MINE= "\uD83D\uDCA3";
private static final String FLAG = "\uD83D\uDEA9";
private int countFlags;
@Override
public void initialize() {
setScreenSize(SIDE, SIDE);// this method will set cell and show
createGame(); // create
}
@Override
public void onMouseLeftClick(int x,int y){
openTile(x,y);
}
private void createGame() {
for (int y = 0; y < SIDE; y++) {
for (int x = 0; x < SIDE; x++) {
boolean isMine = getRandomNumber(10) < 1;
if (isMine) {
countMinesOnField++;
countFlags=countMinesOnField;
}
gameField[y][x] = new GameObject(x, y, isMine);
setCellColor(x, y, Color.YELLOW);
}
}
countMineNeighbors();
}
private List<GameObject> getNeighbors(GameObject gameObject) { // we crete 3*3 matrix and centre elemrnt is same object which are used to call
//and find the number of neighbors contain the mines
List<GameObject> result = new ArrayList<>();
for (int y = gameObject.y - 1; y <= gameObject.y + 1; y++) {
for (int x = gameObject.x - 1; x <= gameObject.x + 1; x++) {
if (y < 0 || y >= SIDE) {
continue;
}
if (x < 0 || x >= SIDE) {
continue;
}
if (gameField[y][x] == gameObject) {
continue;
}
result.add(gameField[y][x]);
}
}
return result;
}
//countMineNeighbors method
private void countMineNeighbors()
{ // to count number of mines
for (int y = 0; y < SIDE; y++) {
for (int x = 0; x < SIDE; x++)
{
if(!gameField[y][x].isMine) //to get number non mind cell
{ //for each non field we count number of neighbors whose has mine
for(GameObject z:getNeighbors(gameField[y][x]))
{
if (z.isMine == true)
gameField[y][x].countMineNeighbors++;
}
}
}
}
}
private void openTile(int x, int y){
gameField[y][x].isOpen=true;
setCellColor(x, y, Color.GREEN);
int number=0;
for(GameObject z:getNeighbors(gameField[y][x]))
{
if (z.isMine == true)
number++; // to get number of mine neighbors
}
if(gameField[y][x].isMine){
setCellValue(x,y,MINE);
setCellColor(x, y, Color.RED);
}
// to set mines image on proper place
else {
if(number==0)
setCellValue(x,y,"");
for(GameObject p:getNeighbors(gameField[y][x]))
{
if(number==0&&p.isOpen==false)
openTile(p.x,p.y);//recursively on each neighbor that hasn't been revealed.
}
if(number>=1) // at least one mined neighbor, the number of mined neighbors must be displayed on the playing field. Use the setCellNumber(int, int, int)
setCellNumber(x,y,gameField[y][x].countMineNeighbors);
}
}
}