Skip to main content

MMaze

A python maze generator and solver.

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.

import mmaze

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

Get solution and plot on screen:

import mmaze

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

"""
||||||||||||||
||S ********||
||  ||||||**||
||  ||    **||
||  ||||||**||
||  ||    E ||
||||||||||||||
"""

Generate a solution and plot to an image.

import mmaze

m = mmaze.generate(width=10, height=10)
solutions = m.solve(start=(0, 0), end=(9, 9))
m.plot(solution=solutions[0], start=(0, 0), end=(9, 9))
drawing

To make a symmetric maze by passing a symmetry method. Note that width or height must be odd number when you want to solve the generated maze.

In this repo, only backtracking / growingtree / huntandkill / prims algorithms can generate symmetric maze.

import mmaze

start = (0, 0)
end = (10, 10)
m = mmaze.generate(width=11, height=11, symmetry="horizontal")
solutions = m.solve(start=start, end=end)
m.plot(solution=solutions[0], start=start, end=end)
drawing

Install

pip install mmaze

More demo use cases

Demo can be found in test file: tests

Release files for mmaze 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mmaze 0.1.4
File Size Uploaded
mmaze-0.1.4.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mmaze 0.1.4
File Interpreter ABI Platform
mmaze-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 41.4 kB

Release files / mmaze-0.1.4.tar.gz

Download URL mmaze-0.1.4.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6bb5e355509d1e1dcf1cba21f0f1e1cb4533d509e578e93e4746c5a5e9c8aeec
BLAKE2b-256 checksum
How to use checksums
aac307e497dd6ca74985a82252e5a56b58ae0bcd7b42fc4a3ad7630efa6e41d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release files / mmaze-0.1.4-py3-none-any.whl

Download URL mmaze-0.1.4-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b93d3be9b56a877c5b3baf4fadd2f3dba0baf7b65293c5ce09adb4abcc3c8b5b
BLAKE2b-256 checksum
How to use checksums
a8234886fd7a91ab8b83774ff99d4ca009d0c7e5d0f217eb26486ec63dcd06e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page