* Use recursion to solve a maze -- based on example in 
 * Java Software Solutions by Lewis and Loftis
 * Goal is to find a path through a maze of 0's and
 * 1's starting at the upper left-hand corner and ending at
 * the lower right-hand corner. 
 * A 1 indicates a clear path while a 0 indicates a 
 * blocked path.
 * If there is a path, it will be marked with P's.
 * @author Suzanne Balik, 24 Feb 2004
public class Maze {

  private char[][] maze;
  private int rows;
  private int cols;
  //Precondition: Maze is not "ragged", i.e. all rows
  //              have the same length
  //              Upper left-hand and bottom right-hand
  //              corners are marked with 1.
  //Postcondition: The maze is marked with P's denoting
  //               a path through the maze if there is
  //               one and a String representation of 
  //               the maze is returned
  //               Otherwise, the message No path is 
  //               returned
  public Maze(char[][] maze) {
  public String solveMaze() {
    //Find out if there is a path by
    //calling the "helper method"
    //If there is a path, return a String
    //representation of the maze
    //NOTE that the client's maze has been
  private boolean solveMazeHelper(int row, int col) {
    boolean done = false;
    //Check if row,col position is within maze
       //Check if position is clear
         //Check if we're at the lower right-hand 
	 //corner. If so, we're done!!
	 //Else, mark this position as Visited
	 //and try to find a path from it to the 
	 //lower right-hand corner
	 else {
           //Try going right
	   //If that didn't work try going down
	   //If that didnt't work try going left  
	   //If that didn't work try going up
	   //Check if this position is on the path
	   //If so, mark it with a P 
    return done;
  private String solvedMaze() {
    //Change all the 'V's back to 1's
    //Create a String representation of the
  public static void main(String[] args) {
    char[][] maze1 = {{'1','1','1','0','1'},
    char[][] maze2 = {{'1','1','1','0','1'},
    //Try to solve Maze 1
    //Try to solve Maze 2