Question: ooClass description MazeSolver - an object for reading files into a 2 - D array. fields 6 final char fields to define the characters representing
ooClass description
MazeSolver an object for reading files into a D array.
fields
final char fields to define the characters representing the maze.
maze: the two dimensional char array that holds the current maze.
mazePath: the solution to the maze after solving the maze or null if the maze is unsolved.
numCellsVisited: the number of cells visited for the current maze solved.
mazesSolved: the number of mazesSolved
mazesTried: the number of mazesTried
methods
solveMaze : takes a maze, calls findPath, updates mazesTried, updates mazesSolved depending on whether a path was
found.
findPath : this method recursively searches for a path. If a move leads to the goal, then it should be added to mazePath. If a
cell is open and searched marked then the numCellsVisited should increase. Note: the first parameter of findPath is the
column because that is how the euclidean coordinate plane work but the first parameter of a dimensional array is the row
y so be careful to switch the order of parameters correctly otherwise the cardinal directions will be incorect.
getMoves : this method should return the mazePath as an array or null if the maze was not solved.
getNumCellsVisited : returns the number of cells visited the last time solveMaze was called.
getPerformance : this method should return ratio of mazesSolvedmazesTried
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
