/* This is the skeleton of a program that finds the path out of a maze in 3 possible ways: recursively, with a stack, and with a queue. This problem illustrates searching using stacks (depth-first search) and queues (breadth-first search), and recursively. Laura Toma csci 210 */ import java.util.Stack; import java.util.LinkedList; public class Maze { final static char C=' ', X='x', S='s', E='e', V='.'; //the maze private static char[][] maze = { {X, X, X, X, X, X, X, X, X, X}, {X, S, C, C, C, C, C, C, C, X}, {X, C, C, C, X, C, X, X, C, E}, {X, C, X, X, X, C, X, X, C, X}, {X, C, C, C, C, X, X, X, C, X}, {X, X, X, X, C, X, X, X, C, X}, {X, X, X, X, C, X, C, C, C, X}, {X, X, C, X, C, X, X, C, C, X}, {X, X, C, C, C, C, C, C, C, X}, {X, X, X, X, X, X, C, X, X, X} }; //the start position final static int START_I = 1, START_J = 1; //the end position final static int END_I = 2, END_J = 9; public static void main(String[] args) { Maze maze = new Maze(); maze.print(); System.out.println("\n\nFind a path using a stack: "); maze.solveStack(); System.out.println("\n\nFind a path using a queue: "); maze.solveQueue(); System.out.println("\n\nFind a path recursively: "); maze.solveRec(); } /* ****************************** */ //return the size of the maze (assume square) public int size() { return maze.length; } //print the maze public void print() { for (int i=0; i= 0 && i= 0 && j