Question: Maze solver 1 ) . Use a Depth First Search to solve a maze to be represented as graphic instead of text file. The first

Maze solver
1). Use a Depth First Search to solve a maze to be represented as graphic instead of text file.
The first line contains the integer value 10 which indicates that this maze has 10 rows and 10 columns.
10
......... G
.#########
.#########
.#...#####
.#.#######
...#######
. #########
.#########
.. S#######
.#########
2). Write two java classes MazeSolve and MazeTest
The MazeSolver should have the following properties:
public void solveMaze()
{
solveMaze(startX, startY);
}
A private method called solveMaze with a signature public boolean solveMaze(int x, int y) that implements algorithms called find path.
Member variable n indicating the size of the n x n member variable called maze. maze stores the values of the maze and the current path.
Member variables startX, startY, goalX, and goalY indicating the starting and goal positions in the maze.
Method readMaze to read a maze.
Method displayMaze to display a maze in graphic.
Method solveMaze that finds the path between the start and goal positions.
3). Modify the below code as appropriate in order to meet the above requirements
public void readMaze()
{
try
{
FileReader fr = new FileReader (filename) ;
BufferedReader br = new BufferedReader (fr);
n=Integer-parseInt (br. readLine()) ;
maze = new char [n][n] ;
for (int i=0; 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!