prajwalsouza / Maze-Solver

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 Agorithm along with dead end filling.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maze Solver

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.

Module dependencies

It's important that the following Modules are installed.

  1. Numpy and Matplotlib
  2. OpenCV

Process

Both the Algorithms take images as input. But, with certain necessary conditions.

  1. The Entrance and the Exit of the maze must be closed and marked.
  2. The Co-ordinates of the Entrance and the Exit in the image must be noted.
  3. The gap between the walls must also be noted, since it is an input into the algorithm.
  4. The Input image is "prefered" to be Black and White.

Example :

The Input Image Input Image

Tree Diagram
Both Algorithms draw a tree like graph.

Input Image

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.
Input Image

For more details on how the algorithm proceeds refer the comments in the program files.

Thank you.

Prajwal DSouza
3rd July 2017

About

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 Agorithm along with dead end filling.


Languages

Language:Python 100.0%Language:OpenEdge ABL 0.0%