Board.java
/*
     * Description: method for condition when losing the game. Uncovers all cells 
     * that contain mines on the calling board, and draws a message telling the user
     * they lost the game and to press the 'r' key to reset the game. Also sets the
     * lost attribute of the game to true to change behavior of clickedCell().
     * Input: N/A, only called on a Board object.
     * Output: N/A, only changes attributes of different fields of the calling Board,
     * and draws using PennDraw, with no explicit outputs.
     */
method for condition when losing the game. Uncovers all cells
that contain mines on the calling board, and draws a message telling the user
they lost the game and to press the 'r' key to reset the game. Also sets the
lost attribute of the game to true to change behavior of clickedCell().
Input: N/A, only called on a Board object.
Output: N/A, only changes attributes of different fields of the calling Board,
and draws using PennDraw, with no explicit outputs.
method for condition when losing the game . Uncovers all cells that contain mines on the calling board and draws a message telling the user they lost the game and to press the ' r ' key to reset the game . Also sets the lost attribute of the game to true to change behavior of clickedCell () . Input : N / A only called on a Board object . Output : N / A only changes attributes of different fields of the calling Board and draws using PennDraw with no explicit outputs .
public void lose() {
        for (int i = 0; i < cells.length; i++) {
            for (int j = 0; j < cells[0].length; j++) {
                if (this.cells[i][j].mineGet()) {
                    this.cells[i][j].uncover();
                }
            }
        }
        PennDraw.setPenColor(150, 150, 150);
        PennDraw.filledRectangle(4.5, 8.1, 2.5, .7);
        PennDraw.filledRectangle(4.5, 1.58, 2.4, .4);
        PennDraw.setPenColor(215, 215, 215);
        PennDraw.filledRectangle(4.5, 8.1, 2.4, .6);
        PennDraw.filledRectangle(4.5, 1.58, 2.35, .35);
        PennDraw.setPenColor(194, 19, 19);
        PennDraw.setFontSize(60);
        PennDraw.text(4.5, 8, "You Lose");
        PennDraw.setPenColor(PennDraw.BLACK);
        PennDraw.setFontSize(32);
        PennDraw.text(4.5, 1.5, "Press r to Restart");
        this.lost = true;
    }
public void lose ( ) { for ( int i = 0 ; i < cells . length ; i ++ ) { for ( int j = 0 ; j < cells [ 0 ] . length ; j ++ ) { if ( this . cells [ i ] [ j ] . mineGet ( ) ) { this . cells [ i ] [ j ] . uncover ( ) ; } } } PennDraw . setPenColor ( 150 , 150 , 150 ) ; PennDraw . filledRectangle ( 4.5 , 8.1 , 2.5 , .7 ) ; PennDraw . filledRectangle ( 4.5 , 1.58 , 2.4 , .4 ) ; PennDraw . setPenColor ( 215 , 215 , 215 ) ; PennDraw . filledRectangle ( 4.5 , 8.1 , 2.4 , .6 ) ; PennDraw . filledRectangle ( 4.5 , 1.58 , 2.35 , .35 ) ; PennDraw . setPenColor ( 194 , 19 , 19 ) ; PennDraw . setFontSize ( 60 ) ; PennDraw . text ( 4.5 , 8 , "You Lose" ) ; PennDraw . setPenColor ( PennDraw . BLACK ) ; PennDraw . setFontSize ( 32 ) ; PennDraw . text ( 4.5 , 1.5 , "Press r to Restart" ) ; this . lost = true ; }
Description: method for condition when losing the game.
Description : method for condition when losing the game .
// condition for what happens when losing the game
 // upper/bottom banner backgrounds
 // upper/bottom banner foregrounds
 // text for losing
 // lose condition
