Board.java
/*
     * Description: after first cell is clicked, place() places 10 mines in random
     * locations in the Cell[][] of the board, avoiding the first cell. Then,
     * the function allocates numbers to cells in the Cell[][] based on adjacent
     * mines, and opens up/uncovers the first cell that was clicked (as well as
     * any adjacents if the first clicked is empty). Finally, sets the first 
     * attribute of the Board object to false, so placement only occurs once/game.
     * Input: N/A, called on a game object to place mines and uncover first cell
     * clicked; updates attributes of the game but has no output.
     * Output: N/A, only updates/changes attributes of the game, no explicit output.
     */
after first cell is clicked, place() places 10 mines in random
locations in the Cell[][] of the board, avoiding the first cell. Then,
the function allocates numbers to cells in the Cell[][] based on adjacent
mines, and opens up/uncovers the first cell that was clicked (as well as
any adjacents if the first clicked is empty). Finally, sets the first
attribute of the Board object to false, so placement only occurs once/game.
Input: N/A, called on a game object to place mines and uncover first cell
clicked; updates attributes of the game but has no output.
Output: N/A, only updates/changes attributes of the game, no explicit output.
after first cell is clicked place () places 10 mines in random locations in the Cell [] [] of the board avoiding the first cell . Then the function allocates numbers to cells in the Cell [] [] based on adjacent mines and opens up / uncovers the first cell that was clicked ( as well as any adjacents if the first clicked is empty ) . Finally sets the first attribute of the Board object to false so placement only occurs once / game . Input : N / A called on a game object to place mines and uncover first cell clicked ; updates attributes of the game but has no output . Output : N / A only updates / changes attributes of the game no explicit output .
private void place() {
        int minesPlaced = 0;
        while (minesPlaced < MINES) {
            int i = (int) (Math.random() * 9);
            int j = (int) (Math.random() * 9);
            if (this.cells[i][j].mineGet() || this.cells[i][j] == 
                this.firstClicked) {
                continue;
            }
            else {
                cells[i][j].mineSet();
                cells[i][j].numberSet(9);
                minesPlaced++;
            }
        }
        for (int i = 0; i < cells.length; i++) {
            for (int j = 0; j < cells[0].length; j++) {
                if (this.cells[i][j].mineGet()) {
                    if (i + 1 < cells.length) {
                        this.cells[i + 1][j].numberAdd();
                    }
                    if (i + 1 < cells.length && j + 1 < cells[0].length) {
                        this.cells[i + 1][j + 1].numberAdd();
                    }
                    if (j + 1 < cells[0].length) {
                        this.cells[i][j + 1].numberAdd();
                    }
                    if (i > 0) {
                        this.cells[i - 1][j].numberAdd();
                    }
                    if (i > 0 && j > 0) {
                        this.cells[i - 1][j - 1].numberAdd();
                    }
                    if (j > 0) {
                        this.cells[i][j - 1].numberAdd();
                    }
                    if (i > 0 && j + 1 < cells[0].length) {
                        this.cells[i - 1][j + 1].numberAdd();
                    }
                    if (i + 1 < cells.length && j > 0) {
                        this.cells[i + 1][j - 1].numberAdd();
                    }
                }
            }
        }
        for (int i = 0; i < cells.length; i++) {
            for (int j = 0; j < cells[0].length; j++) {
                if (cells[i][j] == firstClicked) {
                    emptyAdjacents(cells, i, j);
                }
            }
        }
        this.first = false;
    }
private void place ( ) { int minesPlaced = 0 ; while ( minesPlaced < MINES ) { int i = ( int ) ( Math . random ( ) * 9 ) ; int j = ( int ) ( Math . random ( ) * 9 ) ; if ( this . cells [ i ] [ j ] . mineGet ( ) || this . cells [ i ] [ j ] == this . firstClicked ) { continue ; } else { cells [ i ] [ j ] . mineSet ( ) ; cells [ i ] [ j ] . numberSet ( 9 ) ; minesPlaced ++ ; } } for ( int i = 0 ; i < cells . length ; i ++ ) { for ( int j = 0 ; j < cells [ 0 ] . length ; j ++ ) { if ( this . cells [ i ] [ j ] . mineGet ( ) ) { if ( i + 1 < cells . length ) { this . cells [ i + 1 ] [ j ] . numberAdd ( ) ; } if ( i + 1 < cells . length && j + 1 < cells [ 0 ] . length ) { this . cells [ i + 1 ] [ j + 1 ] . numberAdd ( ) ; } if ( j + 1 < cells [ 0 ] . length ) { this . cells [ i ] [ j + 1 ] . numberAdd ( ) ; } if ( i > 0 ) { this . cells [ i - 1 ] [ j ] . numberAdd ( ) ; } if ( i > 0 && j > 0 ) { this . cells [ i - 1 ] [ j - 1 ] . numberAdd ( ) ; } if ( j > 0 ) { this . cells [ i ] [ j - 1 ] . numberAdd ( ) ; } if ( i > 0 && j + 1 < cells [ 0 ] . length ) { this . cells [ i - 1 ] [ j + 1 ] . numberAdd ( ) ; } if ( i + 1 < cells . length && j > 0 ) { this . cells [ i + 1 ] [ j - 1 ] . numberAdd ( ) ; } } } } for ( int i = 0 ; i < cells . length ; i ++ ) { for ( int j = 0 ; j < cells [ 0 ] . length ; j ++ ) { if ( cells [ i ] [ j ] == firstClicked ) { emptyAdjacents ( cells , i , j ) ; } } } this . first = false ; }
Description: after first cell is clicked, place() places 10 mines in random
 locations in the Cell[][] of the board, avoiding the first cell.
Description : after first cell is clicked place () places 10 mines in random locations in the Cell [] [] of the board avoiding the first cell .
// place mines in random locations in board's cell array
 // don't want to repeat bombs or have first click be bomb
 // place mines
 // calculate numbers for cells based on bombs placed
 // draw only cell that is uncovered after numbers have been calculated
 // no longer first draw/place
