src/Grid.java
public boolean createCircleField(int layers, int cellsPerLayer, int numMines){
        GridStyle oldStyle = this.style;
        Matrix<Cell> oldMatrix = this.m;

        this.style = GridStyle.CIRCLE;
        this.renew(layers, cellsPerLayer, new Cell(GameState.ZERO));

        if(numMines > this.getPlayableSize() || numMines < 0) {
            this.style = oldStyle;
            this.m = oldMatrix;
            return false;
        }

        int mineCount = 0;
        int index, r, c;
        Random rand = new Random();
        while (mineCount < numMines) {
            index = rand.nextInt(this.m.getRow() * this.m.getCol());
            r = this.m.getCoordinatesFromFlattened(index + 1).getLeft();
            c = this.m.getCoordinatesFromFlattened(index + 1).getRight();
            if (!this.m.getEntry(r, c).isMine()) {
                this.m.getEntry(r, c).setMine();
                ++mineCount;
            }
        }

        for (int i = 1; i <= this.m.getRow(); i++)
            for (int j = 1; j <= this.m.getCol(); j++)
                if (!this.m.getEntry(i, j).isMine())
                    this.m.getEntry(i, j).cellstate.setAdjacentMines(this.countAdjacentMines(i, j));

        return true;
    }
//2 cells above and 2 cells below
2 cells above and 2 cells below
2 cells above and 2 cells below
public boolean createCircleField(int layers, int cellsPerLayer, int numMines){
        GridStyle oldStyle = this.style;
        Matrix<Cell> oldMatrix = this.m;
        this.style = GridStyle.CIRCLE;
        this.renew(layers, cellsPerLayer, new Cell(GameState.ZERO));
        if(numMines > this.getPlayableSize() || numMines < 0) {
            this.style = oldStyle;
            this.m = oldMatrix;
            return false;
        }
        int mineCount = 0;
        int index, r, c;
        Random rand = new Random();
        while (mineCount < numMines) {
            index = rand.nextInt(this.m.getRow() * this.m.getCol());
            r = this.m.getCoordinatesFromFlattened(index + 1).getLeft();
            c = this.m.getCoordinatesFromFlattened(index + 1).getRight();
            if (!this.m.getEntry(r, c).isMine()) {
                this.m.getEntry(r, c).setMine();
                ++mineCount;
            }
        }
        for (int i = 1; i <= this.m.getRow(); i++)
            for (int j = 1; j <= this.m.getCol(); j++)
                if (!this.m.getEntry(i, j).isMine())
                    this.m.getEntry(i, j).cellstate.setAdjacentMines(this.countAdjacentMines(i, j));
        return true;
    }
public boolean createCircleField ( int layers , int cellsPerLayer , int numMines ) { GridStyle oldStyle = this . style ; Matrix < Cell > oldMatrix = this . m ; this . style = GridStyle . CIRCLE ; this . renew ( layers , cellsPerLayer , new Cell ( GameState . ZERO ) ) ; if ( numMines > this . getPlayableSize ( ) || numMines < 0 ) { this . style = oldStyle ; this . m = oldMatrix ; return false ; } int mineCount = 0 ; int index , r , c ; Random rand = new Random ( ) ; while ( mineCount < numMines ) { index = rand . nextInt ( this . m . getRow ( ) * this . m . getCol ( ) ) ; r = this . m . getCoordinatesFromFlattened ( index + 1 ) . getLeft ( ) ; c = this . m . getCoordinatesFromFlattened ( index + 1 ) . getRight ( ) ; if ( ! this . m . getEntry ( r , c ) . isMine ( ) ) { this . m . getEntry ( r , c ) . setMine ( ) ; ++ mineCount ; } } for ( int i = 1 ; i <= this . m . getRow ( ) ; i ++ ) for ( int j = 1 ; j <= this . m . getCol ( ) ; j ++ ) if ( ! this . m . getEntry ( i , j ) . isMine ( ) ) this . m . getEntry ( i , j ) . cellstate . setAdjacentMines ( this . countAdjacentMines ( i , j ) ) ; return true ; }
2 cells above and 2 cells below
2 cells above and 2 cells below