Maze ADT:
Maze.java source
Maze.java documentation
Test mazes format:
Note that S=start, F=finish
12 <----- number of columns 7 <----- number of rows xxxxxxSxxxxx xxxxxx xx xx xx x xxxxxx x xxx xxx x xxx x xxx xx xFxxxxxxxxxx
Test mazes:
maze1.txt
maze2.txt
maze3.txt
maze4.txt
maze5.txt
maze6.txt Note explicit spaces at end of lines
Sample Output. Note that a period (.) represents a part of the solution path, and a dash (-) represents a part of the attempted, but ultimately rejected path.
Finally...here's the main from the program used in the sample output. This is just a hint. Your main does not have to look like this.
public class MazeSolver{
public static void main(String[] args){
if (args.length == 0){
System.out.println("usage:\njava MazeSolver maze_config_file");
}
else{
Maze maze = new Maze();
maze.initialize(args[0]);
MazeSolver ms = new MazeSolver();
if (ms.solve(maze)){
System.out.println("Success!");
}
else{
System.out.println("Maze cannot be solved");
}
maze.printMaze();
}
}
:
:
:
}