Question: Q: In Java and using recursion and a 2d array. You need to make a maze solver. The program will take in from a file

Q:

In Java and using recursion and a 2d array.

You need to make a maze solver. The program will take in from a file 2 things. The size of the square maze, and the maze itself. The maze will consists of numbers between 0 and 3, where 0 is the starting point of the maze, 1 is an open path, 3 is a wall and blocked , and 2 is the end. The maze will be no larger than 40x40. For example a 6x6 maze could be represented by the following file, there will be no spaces seperating the elements of the maze:

6 011113 333313 111113 331333 331111 333332  

The program must then solve the maze. It will then output the correct path through the maze marked by 0s to the command line. For example for the maze above could output the following.

000003

333301

110003

330333

330000

333330

You can assume that the input contains the exact amount of numbers needed and that it is a solvable maze, following the rules outlined above.

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 Databases Questions!