Player.java
public void dig()
    {
        if(!(maze.grid[getX()][getY()] instanceof Hole)) {
            //don't dig, nothing there.
        }
        else {
            maze.grid[getX()][getY()] = null;
            Random r = new Random();
            r.setSeed(System.currentTimeMillis());
            int num = r.nextInt(5);
            if(num == 0) {
                System.out.println("0");
                maze.addPoints(100);
                maze.print("You gained 100 points!");
            }
            else if((num == 1) || (num == 4)) {
                System.out.println("0 or 4");
                maze.addMonster(new Monster(0,4, maze));
                maze.print("A monster appeared!");
            }
            else if(num == 2) {
                System.out.println("2");
                maze.addPoints(250);
                maze.print("Congratulations!");
            }
            else if(num == 3) {
                System.out.println("3");
                maze.addPoints(500);
                maze.print("You found a hidden treasure! +500 points!");
            }
            Digger maze2 = (Digger) maze;
            if(maze2.getHolesCount() <= 1) {
                maze2.addHole(r.nextInt(maze.SIZE), r.nextInt(maze.SIZE));
            }
        }
    }
/** 
     * Provides functionality for the Digger Maze game.
     * Produces prizes for digging up the X's, however some digs
     * produce a monster! out run it, or kill it with a bomb ('b')
     * The bomb costs 1000 points.
     */
Provides functionality for the Digger Maze game.
Produces prizes for digging up the X's, however some digs
produce a monster. out run it, or kill it with a bomb ('b')
The bomb costs 1000 points.
Provides functionality for the Digger Maze game . Produces prizes for digging up the X ' s however some digs produce a monster . out run it or kill it with a bomb ( ' b ' ) The bomb costs 1000 points .
public void dig()
    {
        if(!(maze.grid[getX()][getY()] instanceof Hole)) {
        }
        else {
            maze.grid[getX()][getY()] = null;
            Random r = new Random();
            r.setSeed(System.currentTimeMillis());
            int num = r.nextInt(5);
            if(num == 0) {
                System.out.println("0");
                maze.addPoints(100);
                maze.print("You gained 100 points!");
            }
            else if((num == 1) || (num == 4)) {
                System.out.println("0 or 4");
                maze.addMonster(new Monster(0,4, maze));
                maze.print("A monster appeared!");
            }
            else if(num == 2) {
                System.out.println("2");
                maze.addPoints(250);
                maze.print("Congratulations!");
            }
            else if(num == 3) {
                System.out.println("3");
                maze.addPoints(500);
                maze.print("You found a hidden treasure! +500 points!");
            }
            Digger maze2 = (Digger) maze;
            if(maze2.getHolesCount() <= 1) {
                maze2.addHole(r.nextInt(maze.SIZE), r.nextInt(maze.SIZE));
            }
        }
    }
public void dig ( ) { if ( ! ( maze . grid [ getX ( ) ] [ getY ( ) ] instanceof Hole ) ) { } else { maze . grid [ getX ( ) ] [ getY ( ) ] = null ; Random r = new Random ( ) ; r . setSeed ( System . currentTimeMillis ( ) ) ; int num = r . nextInt ( 5 ) ; if ( num == 0 ) { System . out . println ( "0" ) ; maze . addPoints ( 100 ) ; maze . print ( "You gained 100 points!" ) ; } else if ( ( num == 1 ) || ( num == 4 ) ) { System . out . println ( "0 or 4" ) ; maze . addMonster ( new Monster ( 0 , 4 , maze ) ) ; maze . print ( "A monster appeared!" ) ; } else if ( num == 2 ) { System . out . println ( "2" ) ; maze . addPoints ( 250 ) ; maze . print ( "Congratulations!" ) ; } else if ( num == 3 ) { System . out . println ( "3" ) ; maze . addPoints ( 500 ) ; maze . print ( "You found a hidden treasure! +500 points!" ) ; } Digger maze2 = ( Digger ) maze ; if ( maze2 . getHolesCount ( ) <= 1 ) { maze2 . addHole ( r . nextInt ( maze . SIZE ) , r . nextInt ( maze . SIZE ) ) ; } } }
Provides functionality for the Digger Maze game.
Provides functionality for the Digger Maze game .
//don't dig, nothing there.