<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">

/** The contents of the maze, the two rats, Steve and Jen, and
    the number of brussels sprouts eaten. */
public class Maze {
    
    // ----------------------------------------------------------------
    // Constants for the contents of the maze.
    
    /** The visual representation of a wall. */
    public static final char WALL = '#';
    
    /** the visual representation of a hallway. */
    public static final char HALL = '.';
    
    /** the visual representation of a brussels sprout. */
    public static final char SPROUT = '@';
    
    /** The letter representing Steve. */
    public static final char STEVE_CHAR = 'S';
    
    /** the letter representing Jen. */
    public static final char JEN_CHAR = 'J';
    
    // ----------------------------------------------------------------
    // Constants for the directions. Use these to help make rats move.
    
    /** The left direction. */
    public static final int LEFT = -1;
    
    /** The right direction. */
    public static final int RIGHT = 1;
    
    /** No change in direction. */
    public static final int NO_CHANGE = 0;
    
    /** The up direction. */
    public static final int UP = -1;
    
    /** The down direction. */
    public static final int DOWN = 1;
    
    // -----------------------------------
    //  The two rats
    
    /** Jen and Steve, the rats */
    public final Rat JenTheRat= new Rat();
    public final Rat SteveTheRat= new Rat();
    
    /** The 2-d array that contains the maze. Note
        that Jen and Steve do not appear in this maze.
        instead, their positions are given by the two Rats
        JenTheRat and SteveTheRat. So, an element of b can
        contain only WALL, HALL, and SPROUT.*/
    private char[][] b; 
    
    /** number of brussel sprouts in the maze */
    private int numberSprouts;  
    
    /** Constructor: A Maze with 2-d maze b.
        Precondition: b is not null and is a valid maze, and it
        contains 'S' and 'J' to mark the positions of
        the two rats. */
    public Maze(char[][] b) {
        // YOU WRITE THIS METHOD BODY
        
    }
    
    /** = the character at position (r,c) of game*/
    public char getChar(int r, int c) {
        return ' ';  // You have to fix this
    }
    
    /** = number of rows in the maze */
    public int nRows() {
        return 0;    // You have to fix this
    }
    
    /** = number of cols in the maze */
    public int nCols() {
        return 0;  // You have to fix this   
    }
    
    /** = the maze, without the rats, as a string,
         which will print 1 line per row */
    public String toString() {
        if (b == null) return "";
        String res= "";
        
        // Your code goes here
        
        return res;
    }
    
    /** = number of sprouts left in maze */
    public int sproutsLeft() {
        return 0;   // You have to fix this
    }
    
    /** Move rat r vertically as given by vert and horizontally
     as given by horiz. If it is not possible to move, don't.
     Preconditions: r is one of JenTheRat and SteveTheRat.
     vert is NO_CHANGE, UP, or DOWN.
     horiz is NO_CHANGE, LEFT, or RIGHT */
    public void move(Rat r, int vert, int horiz) {
        
        // You have to write the body
    }
}
</pre></body></html>