What I just pushed
maze_solver is a Python app that makes a maze and then solves it while you watch. It has a Tkinter window. The code is at https://github.com/kleinpanic/maze_solver.
Making a maze
You choose how the maze is generated: Recursive Backtracker or Prim. Then you tune it with sliders:
- rows and columns
- dead ends
- branching factor
- connectedness, from 10 to 90 percent
- wall density
- seed
Solving it
You can solve with BFS, DFS or A*. The window animates what the solver does: the cells it has visited, the frontier and the final path. There is a timer, and a stop button for when you have seen enough.
How it works
It is plain Python, split into four files:
- main.py, 213 lines
- maze_generator.py, 191 lines
- pathfinding_algorithms.py, 122 lines
- render.py, 281 lines
It needs no external packages except tkinter. You run it like this:
git clone https://github.com/kleinpanic/maze_solver
cd maze_solver
python3 main.py
What is not done
The LICENSE file is MIT, but I left the placeholders in it: [year] and [fullname]. I have to fill those in.
My very first commit had a whole virtual environment in it. I cleaned that up in the next one.
There is no tag yet.
P.S Thanks for reading. Consider subbing to the RSS feed.
Klein Panic