Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exciteabletom/mazesolver
A maze solving program for black and white images
https://github.com/exciteabletom/mazesolver
algorithms easy-to-use image-manipulation image-processing image-recognition maze shortest-path
Last synced: 2 months ago
JSON representation
A maze solving program for black and white images
- Host: GitHub
- URL: https://github.com/exciteabletom/mazesolver
- Owner: exciteabletom
- License: gpl-3.0
- Created: 2020-02-29T13:59:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-22T16:49:06.000Z (over 4 years ago)
- Last Synced: 2024-09-20T09:13:50.355Z (3 months ago)
- Topics: algorithms, easy-to-use, image-manipulation, image-processing, image-recognition, maze, shortest-path
- Language: Python
- Homepage: https://pypi.org/project/mazesolver
- Size: 55.9 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Maze Solver
This program finds the shortest path through black and white maze images. It outputs an image with the path marked in green.
## Installing
Check that your python version is >=3.5 with `python3 -V`.
Also make sure that pip is installed with `python3 -m pip -V`.To install, simply run `python3 -m pip install mazesolver --user` on the command line.
You can run the tool using `mazesolver` or `mazesolver.exe`.
## What are the rules for maze images?
- Walls marked with black pixels and paths marked with white pixels
- Walls around the entire maze
- One entrance on the top row and one exit on the bottom row
You can generate a compatible maze using mazegenerator, or just make your own image in an image editing program.
*If this is confusing, check out some of the example mazes in the **pics** directory.*
## How do I use it?
You can use `mazesolver --help` to get a list of commands.
Make sure that your image meets the specifications above.
Normal usage will look something like this: `mazesolver -i path/to/input_img -o path/to/output_dir/`
## How does the algorithm work?
- Start at the entrance and label it zero.
- Move to any neighbouring cells and mark them with 1
- Move to any of the cells neighbouring the ones marked 1 and label them 2
- Continue doing this until all cells are marked
- Start from the exit of the maze and move to any neighbouring cell that == the current cell's number -1. Until we reach 0 (the entrance).
We now have the shortest path from the entrance to the exit!