Stats
-
Forks0
-
Stars0
-
Open Issues0
-
DescriptionCreate and solve a maze or mazes
maze_solver.py and maze_solver_finder.py
Creates a maze and attempts to solve it \
Created as an attempt to bog down the process to test the speed differences in windows. \
I found noticeable difference when running code in macOS, Windows and the Windows subsystem, I wanted to explore this \
Performance was too good so needed to loop it, so I created maze_solver_finder.py for that
Example is --seed 4249 --size 30
↓
↑ → ↓ → → ← ↑ → ← + ↓ ↓ ↓ ↓ ← → ↓ → ↑ → + + ← → ↓ + ↓ ↓ ← ↑
↓ + ↓ ← ↓ + ← + ↑ ← ↑ → → ↑ → ← → → ↓ + ← ← ↑ ↑ ↓ + → ↑ ↑ +
↓ + → + ↓ ← ↑ ↑ ← ↑ ↑ → ↑ ← ↓ → → + + ↓ ← + ↓ ↓ ↑ ↓ ← ← ↓ +
← → ← ↑ ↓ ↓ ↓ ↓ ← + ↓ ↓ ↑ + ↑ ↓ ← + ← ← ← ↓ ↓ + + → → ↓ → ←
↓ ↓ ← → + ↑ + + ↓ ↑ + ↑ ↓ ← → ← ← + ↓ → ↑ ← + ← ↑ ← ← ← → ↓
+ → ↓ ↑ ← ← ↓ ← ← → ↓ ↓ → ↑ ← ↓ + ↓ ← ↓ ← ↑ ↓ ← ↑ + + ↓ ↓ ←
+ + → + ← ↓ → ↑ → ↑ → ↓ → ← → ↓ → → ↓ → + ↑ ↑ ↑ ← ↓ ↓ ↓ ↓ +
→ ↑ ↓ ← ↓ + + ↑ ↓ ↓ ← ← + ← ← → + ↓ + + ← + ↑ ← ↓ ↑ → + ← ↑
+ → ↑ ↓ ↓ ← ↑ ↓ → ← + ↑ ↓ + → + ↑ ↓ + ← ↑ + ↑ + + ↑ + ← + ←
↓ + ↑ ↓ ↑ ↓ + ↑ ↓ ↓ ↑ ↓ ← ↑ ↑ ↑ ↑ ← + + → ← + ↑ ↑ ↑ ← ↑ → ↓
← ← ↓ → → ↑ ↑ ← ↓ ↑ ↓ ← → ↓ ← + ↑ ↑ → + ↑ → ← → ↓ ↓ ← ↓ ← ↑
↓ ↑ + → ← ↓ ← ↓ → ↓ ↑ ↓ ↓ ↑ ← ← ↓ ← + ← ↓ + + ← ↓ ↓ ↓ → ↑ ↓
+ ← ↓ + ↑ ← + → + ← → ↑ ↓ + ↓ + + → ↑ ↓ → ↓ → ← + ← ↓ ↑ → ↓
+ → ← ← → + ← + + ← ← ↑ ↓ + ← → ↑ → ↓ → → ↑ → ↑ ↓ → → → ↑ +
↑ ↑ ← → ↑ ↓ + ↑ + ← ← ← + + + ← + ← + + + ↑ ← ↓ ← ↓ ↓ ← ← ↑
+ ↑ ← ← ↑ ← ↓ ↑ ← ← ↑ ↑ ← + ↓ ↑ + ↑ + ← ← + + ← → + ← ← ↓ ↓
↑ → ← ↑ → ↓ ← ← ↑ ↑ ↓ ← ↓ + + ↑ ↑ ← + ← + + ↓ ← + → → → → ↓
+ ← → + → ← → ↑ + ↓ + ↑ ← ↓ ↓ ↓ ↓ ↑ → ← ↑ + + ← ← → → → → ↑
→ ← → → ← → → ← + → ↑ ← → ← + → ↑ ← → ← → + ← ← ↑ ↓ ↓ ↓ ↑ ↑
↓ → → → ↑ ← ← + ← → ↓ ← ← + + ↓ + ← ↓ + ← ↑ ↑ ↓ ← ← ← → ↓ ↓
↑ → ↑ ↑ ← ← + ↓ + ↓ ↑ ← ↑ ↑ ↓ ← ↑ ↑ ← + + ↑ + ↑ + ↓ → ↓ + →
+ ↑ ↓ ← → → → ↓ → → ↑ → ← → ↓ + ↓ ← → ↓ ← + ↑ ↑ ↓ + + + ↓ ↑
↑ ← ↑ ↑ ↓ ← ↑ ↑ ← ↓ + ← ↓ ↑ + + → → ↓ ↑ ← + ↑ ↓ ↑ + ← + → →
+ ↓ + + ↓ ← ↓ ↓ ↓ + ↓ → → ↑ → + + + → → + + ↓ ↓ → → ↓ ↑ ← →
→ + + ↓ ↑ ← ↑ → → → + ↑ ↑ ↑ ← ↑ ↑ ↓ + ↓ ↓ + ← → + ↑ ← ↓ ↓ →
← + ↑ + ↓ ← + + ← ↑ + → ↓ ← → ← + + ← ↓ ↑ ↑ + ← ↓ ← ← ↑ ↓ ↑
↓ + ↑ ↑ + ↑ ↑ ← → ↓ → ↓ + + ↑ + + → + ↑ → ↓ → ↓ + ↓ → ↓ ← →
↑ ↑ → ← ↑ ↓ ← ↓ ↑ + ↓ ← ↑ + ↓ ← ↓ + → → ← ↓ + ↓ ↓ + ↓ ↓ ↑ ←
← + + → ← + ← ↓ → ↓ + ← + ↓ ↓ ↑ ← + ↑ ← ← + + ← ↓ ← ↓ ← ← ↓
↑ ↑ ← ← ↑ + ↑ → ↓ ↓ ↑ ↑ → → → ↓ ↑ ← ↓ ↓ ↓ + + ← + ↓ ↓ + + ←
↓
Solution(s):
↓
→ ↓
→ → ↓
+ + ↓
+ ← ←
+ ↓
↓ ←
→ ↓
+ +
+ ←
+ +
→ +
↓ ← + ←
↓ + ↓ + +
↓ + ←
+ + +
+ ↓
+ +
↓
+
+ ↓
↓ ←
↓
+ +
→ + + +
↓
+ +
+ +
↓ ← ↓
↓ ↑ ←
→ ↓
↓
What?
maze_solver.py
Create a maze and solve it or use maze_solver_finder to get a maze
You can use a custom the size of the maze or the seed used to randomly generate it
usage: maze_solver.py [-h] [-d SIZE] [-s SEED] [--short | --long] [--debug]
Create a maze and solve it
optional arguments:
-h, --help
show this help message and exit
-d SIZE, --size SIZE
Size of the puzzle
Default: 10
-s SEED, --seed SEED
Seed the random to set reproducible results
Default: None
--short
Return only the shortest path
Default: None
--long Return only the longest path
Default: None
--debug
Debug the program
Default: False
maze_solver_finder.py
usage: maze_solver_finder.py [-h] [-d SIZE SIZE] [-s SEED SEED] [--short | --long] [--single] [--debug]
Create a batch of mazes, solve and display the solvable ones.
optional arguments:
-h, --help
show this help message and exit
-d SIZE SIZE, --size-range SIZE SIZE
Minimum and maximum values
Default: [5, 10]
-s SEED SEED, --seed-range SEED SEED
Seed of the random range
Default: [0, 320000]
--short
Return only the shortest paths
Default: None
--long Return only the longest paths
Default: None
--single
Stop after the first puzzle is found
Default: False
--debug
Debug the program
Default: False
Why?
I was trying to find why the Windows python was so much slower and looking for a potentially tasking process and through a maze solver might do the trick. I was very incorrect. So I created a maze_solver_finder.py that will create 1000s of mazes and solve them for a bigger time delta.
End result was unimpressive. Might be string related methods. Expect to see more.
Improvements?
Multitasking? I don't think it can run too much faster though.
State?
Tested and working. No know bugs.