Skip to main content

A shortest-path maze solving algorithm for image-based mazes.

Project description

Maze Solver

Upload Python Package

This algorithm 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

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mazesolver-2.0.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mazesolver-2.0.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file mazesolver-2.0.1.tar.gz.

File metadata

  • Download URL: mazesolver-2.0.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for mazesolver-2.0.1.tar.gz
Algorithm Hash digest
SHA256 79027b726918955b0f197399becdc67aa27f8ef7cc1d9ec6b1822f186e574b39
MD5 f23d1ec30ad13b9ade7066e0309be36e
BLAKE2b-256 f39f7cb5ceb31c635d930f64982d142e0a9a1514c64b1eb1e603e4fdfd5c4b5a

See more details on using hashes here.

File details

Details for the file mazesolver-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: mazesolver-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for mazesolver-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 deb82b01709cc2662271e6bfd0b84677755d595299b85ea294e1a8ba5977c982
MD5 abee426bebb193865fb780036ebfc6c9
BLAKE2b-256 789c735f6357e014af238617d2f9f6ceaabfdfd4af6ed0bc6391bd6375122ee7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page