Task

For a maze generated by this task, write a function
that finds (and displays) the shortest path between two cells.



Note that because these mazes are generated by the Depth-first search algorithm, they contain no circular paths,
and a simple depth-first tree search can be used.




procedure main(A)
   /mh := \A[1] | 12
   /mw := \A[2] | 16
   mz := DisplayMaze(GenerateMaze(mh,mw))
   WriteImage(mz.filename)              # save file
   WAttrib(mz.window,"canvas=normal")   # show it
   until Event() == &lpress # wait for left mouse press
   Solver(mz.maze)
   DisplayMazeSolution(mz)
   WriteImage(mz.filename ?:= (="maze-", "maze-solved-" || tab(0)))
   until Event() == &lpress # wait
   close(mz.window)
end