Generates a maze in the form of a black-and-white PNG image, with black being walls and white being walkways
The maze is surrounded by a 1-pixel-wide layer of black pixels (the outer walls), except for the entrance at the top and exit at the bottom
Passing size parameters:
maze_maker.py 300 100
Creates a 300x100 maze, saves as "300x100_n.png", where n is the first available positive integer
Without any parameters it creates a 400x400 maze
- First creates the main path from entrance to exit
- Fills the remaining space with randomly branching paths
- Final cleaning, gets rid of unnecessary parts like 3x3 white squares, fills holes, etc
Solves a maze that's in a format like maze_maker makes, by converting the maze to a graph and using A* to search for the shortest path
Passing filename parameters:
maze_solver_.py 300x100_2.png
If you don't provide a filename, it tries to open 400x400_0.png by default. You can change this default in the script
- Converts the maze to a graph
- This means junctions and turns are converted to graph nodes
- Uses the A* algorithm to find the shortest path