Skip to main content

Generating and solving maze

Project description

MMaze

A simple python maze generator and solver.

Simple usage

Generating a maze with specific width and height. Print on screen directly.

import mmaze

m = mmaze.generate(width=3, height=3)
print(m)

"""
■■■■■■■
■ ■   ■
■ ■ ■■■
■     ■
■■■ ■■■
■     ■
■■■■■■■
"""

Plot the maze to image.

m = mmaze.generate(width=3, height=3)
m.plot()
drawing

Get solution and plot on screen:

m = mmaze.generate(width=3, height=3)
solutions = m.solve(start=(0, 0), end=(2, 2))
print(m.tostring(solution=solutions[0]))

"""
■■■■■■■
■S■   ■
■*■ ■■■
■***  ■
■■■*■■■
■  **E■
■■■■■■■
"""
m = mmaze.generate(width=10, height=10)
solutions = m.sovle(start=(0, 0), end=(9, 9))
m.plot(solution=solutions[0])
drawing

Demo

Demo can be found in test file: tests

Install

pip install mmaze

Download or fork

Download link

Fork this repo:

$ git clone https://github.com/MorvanZhou/mmaze.git

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

mmaze-0.0.6.tar.gz (15.7 kB view hashes)

Uploaded Source

Built Distribution

mmaze-0.0.6-py3-none-any.whl (21.5 kB view hashes)

Uploaded Python 3

Supported by

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