MazeSolver - Assignment 11 Name Daniel Sauter StudentID 1202351076 Lecture M W F 2:00 2:50pm Description The MazeSolver contains two 2-dimetional

MazeSolver - Assignment 11 Name Daniel Sauter StudentID...

This preview shows page 1 - 2 out of 4 pages.

// Assignment #: 11 // Name: Daniel Sauter // StudentID: 1202351076 // Lecture: M W F - 2:00 - 2:50pm // Description: The MazeSolver contains two 2-dimetional character arrays, // one for the original and another to display the // solution to the maze, and the size of maze. // Its findSolution method solves the maze problem // and put the solution in the stack. import java.util.Stack; public class MazeSolver { private char[][] originalMaze; private char[][] maze; private int mazeSize; private Stack<Position> stackSoln; //Constructor to initialize the mazeSize, //initializes two 2-dimensional character arrays. public MazeSolver(String[] mazeInfo) { mazeSize = 10; setupMaze(mazeInfo); stackSoln = new Stack<Position>(); } //the setupMaze method initializes //two character arrays, using the input array of strings. public void setupMaze(String[] mazeInfo) { maze = new char[mazeSize][mazeSize]; originalMaze = new char[mazeSize][mazeSize]; for (int i=0; i<mazeSize; i++) { for (int j=0; j<mazeSize; j++) { originalMaze[i][j] = mazeInfo[i].charAt(j); maze[i][j] = originalMaze[i][j]; } } } //The displayPath methods returns a string describing //how to go from the starting position to the goal position public String displayPath() {

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture