Problem # 22 : Shortest Path (Maze)
Write a sub-routine MAZE which finds the shortest path between two points given in a two-dimension array of characters and also outputs the numbers of steps taken to reach the destination.
The program should accept the number of rows and columns in the maze and then input one of the following four characters into each element of the array :-
| (signifying a wall in the maze)
S (signifying the starting point in the maze)
E (signifying the destination)
- (signifying a blank space)
The path should then be displayed on the screen using '@'
There could be more than one way to reach the destination in the smallest number of steps.
Sample Output
|
|
|
|
![]() |