src/main/java/cz/educanet/minesweeper/logic/Minesweeper.java
public void reveal(int x, int y) {
        Queue<Point> queue = new ArrayDeque<Point>();//vytvoří to frontu bodů
        queue.add(new Point(x, y));
        while (!queue.isEmpty()) {
            Point currentPoint = queue.remove();
            pitchState[currentPoint.x][currentPoint.y] = 1;
            if (getAdjacentBombCount(currentPoint.x, currentPoint.y) == 0) {
                for (int i = Math.max(currentPoint.x - 1, 0); i < Math.min(currentPoint.x + 2, rowsCount); i++) {
                    for (int j = Math.max(currentPoint.y - 1, 0); j < Math.min(currentPoint.y + 2, columnsCount); j++) {
                        if (pitchState[i][j] == 0) {
                            Point nextPoint = new Point(i, j);
                            if (!queue.contains(nextPoint)) {
                                queue.add(nextPoint);
                            }
                        }
                    }
                }
            }
        }
    }
/**
     * Reveals the field and all fields adjacent (with 0 adjacent bombs) and all fields adjacent to the adjacent fields... ect.
     *
     * @param x X
     * @param y Y
     */
Reveals the field and all fields adjacent (with 0 adjacent bombs) and all fields adjacent to the adjacent fields... ect.
@param x X
@param y Y
Reveals the field and all fields adjacent ( with 0 adjacent bombs ) and all fields adjacent to the adjacent fields ... ect . @param x X @param y Y
public void reveal(int x, int y) {
        Queue<Point> queue = new ArrayDeque<Point>();
        queue.add(new Point(x, y));
        while (!queue.isEmpty()) {
            Point currentPoint = queue.remove();
            pitchState[currentPoint.x][currentPoint.y] = 1;
            if (getAdjacentBombCount(currentPoint.x, currentPoint.y) == 0) {
                for (int i = Math.max(currentPoint.x - 1, 0); i < Math.min(currentPoint.x + 2, rowsCount); i++) {
                    for (int j = Math.max(currentPoint.y - 1, 0); j < Math.min(currentPoint.y + 2, columnsCount); j++) {
                        if (pitchState[i][j] == 0) {
                            Point nextPoint = new Point(i, j);
                            if (!queue.contains(nextPoint)) {
                                queue.add(nextPoint);
                            }
                        }
                    }
                }
            }
        }
    }
public void reveal ( int x , int y ) { Queue < Point > queue = new ArrayDeque < Point > ( ) ; queue . add ( new Point ( x , y ) ) ; while ( ! queue . isEmpty ( ) ) { Point currentPoint = queue . remove ( ) ; pitchState [ currentPoint . x ] [ currentPoint . y ] = 1 ; if ( getAdjacentBombCount ( currentPoint . x , currentPoint . y ) == 0 ) { for ( int i = Math . max ( currentPoint . x - 1 , 0 ) ; i < Math . min ( currentPoint . x + 2 , rowsCount ) ; i ++ ) { for ( int j = Math . max ( currentPoint . y - 1 , 0 ) ; j < Math . min ( currentPoint . y + 2 , columnsCount ) ; j ++ ) { if ( pitchState [ i ] [ j ] == 0 ) { Point nextPoint = new Point ( i , j ) ; if ( ! queue . contains ( nextPoint ) ) { queue . add ( nextPoint ) ; } } } } } } }
Reveals the field and all fields adjacent (with 0 adjacent bombs) and all fields adjacent to the adjacent fields... ect.
Reveals the field and all fields adjacent ( with 0 adjacent bombs ) and all fields adjacent to the adjacent fields ... ect .
//vytvoří to frontu bodů