JAVA PRPGRAMMING : Given a maze, a starting point, and an exit, find your way ou
ID: 3553095 • Letter: J
Question
JAVA PRPGRAMMING :
Given a maze, a starting point, and an exit, find your way out of the maze.
Design your solution recursively.
There is only one exit from the maze. You may move horizontally or vertically (but not diagonally) in any direction, in which there is an open path, but you may not move in a direction that is blocked.
INPUT
You will read your input from a file (maze.in).
On the first line, there will be 2 integers separated by a space. The first integer is the height (h) of the maze, and the second is the width (w).
Following you
Explanation / Answer
0 0 B E B 0 0 B B B
0 B B 0 B 0 B 0 0 0
0 0 0 0 0 0 B 0 B 0
B B B B B 0 B B 0 0
0 0 0 B 0 0 0 B 0 B
0 B 0 B 0 B B B 0 B
0 B 0 B 0 0 0 B 0 0
B B 0 B B B 0 B B 0
0 B 0 0 0 0 0 B B 0
0 B 0 B B 0 B 0 0 0
output:
1,2 Exit
10,1 blocked
10,8 blocked
7,6 Exit
1,7 Exit
8,7 Exit
7,9 blocked
9,3 Exit
7,1 Exit
2,8 blocked
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.