Solves Mazes taking an image input, along with the starting and ending points.
There are two Algorithms here which solve mazes. One of them is a Shortest Path Algorithm, the other, Minimal Tree Algorithm along with dead end filling. Both written in Python.
The Shortest Path Algorithm takes longer, infact 10 times longer than Minimal Tree - Dead Ending Filling Algorithm. But, The Dead Ending filling part of the algorithm may not work for all mazes.
It's important that the following Modules are installed.
- Numpy and Matplotlib
- OpenCV
Both the Algorithms take images as input. But, with certain necessary conditions.
- The Entrance and the Exit of the maze must be closed and marked.
- The Co-ordinates of the Entrance and the Exit in the image must be noted.
- The gap between the walls must also be noted, since it is an input into the algorithm.
- The Input image is "prefered" to be Black and White.
Example :
Tree Diagram
Both Algorithms draw a tree like graph.
The Solution
The Solution is then generated by Shortest Path tracing in Dijkstra Algorithm case and by Dead End Filling in the Minimal Tree Algorithm case.
For more details on how the algorithm proceeds refer the comments in the program files.
Thank you.
Prajwal DSouza
3rd July 2017