Skip to content

(Python) Single file that contains a Maze Generator and a Path Finder to this respective maze. Based on the Randomized Prim's Algorithm and A* Algorithm.

License

Notifications You must be signed in to change notification settings

MatheusMAssis/Maze-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maze-Generator

5x5 Maze Initial and Solved States

Alt Text Alt Text

150x150 Maze Initial and Solved States

Alt Text Alt Text

Maze Generator that creates a maze with chosen size and also plots the optimal path to the exit.

Any size is accepted, but for over than 200x200 the algorithm can have an error of stack overflow due to recurrence.

About

In a one-day work, using a Randomized Prim's Algorithm, I created a maze generator. As it was a Friday, I continued doing it until Sunday, when I achieved the final program. The main file consists of one main function and two main processes.

> Generating Maze

Using a Randomized Prim's Algorithm in a Square with size n x m, I could create a Maze Generator. Briefly, this algorithm color its tiles in a way that two adjacent tiles will never be the same (wall/path).

> Finding Exit Path

Using the A* algorithm to find the way out of the generated maze, I could create the Path Finder function. Besides being very efficient, this algorithm find the way out very fast, even with big mazes.

> Path Finder Function

The main function of this program is called path_finder(n, m). When you call it, a maze (with entrance and exit point) is generated and plotted in your output screen. After this, the same program find its exit and color the path in yellow and plot the same maze, but with a yellow path connecting the entrance to the exit. The mean time to run is less than one second for small mazes and it can take up to two seconds for larger mazes. This program won't work for mazes bigger than 150x150, due to recurrency error.

Built With

  • Python - Programming Language used.
  • Algorithm - Where I found Algorithms to generate mazes

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Thanks

Alt Text

Thanks for visiting my GitHub! <3

About

(Python) Single file that contains a Maze Generator and a Path Finder to this respective maze. Based on the Randomized Prim's Algorithm and A* Algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages