Skip to main content

A woodsy maze

maze-nd

A python package for generating n-dimensional mazes via randomized Prim's Algorithm

Initial implementation in 2D from: https://github.com/ArneStenkrona/MazeFun

Getting Started

Prerequisites

Poetry: https://python-poetry.org/docs/#installation

Installation

Clone the repository:

git clone https://github.com/dthuff/maze-nd

and install dependencies:

cd maze-nd/
poetry install

Or, install via pip:

pip install maze-nd

Usage

Generating maze structures

The MazeND class defines a maze data structure represented by a boolean array of arbitrary shape maze.grid.

A 2D maze of 40 rows and 40 columns can be generated with:

from maze_nd.maze_nd import MazeND
maze = MazeND([40, 40])

Note that maze dimensions must be odd to ensure a solid outer border. If even shape args are passed, they will be forced to be odd.

maze = MazeND([40, 40])

>>> maze.grid.shape
(39, 39)

A 3D maze of 40 rows, 40 columns, and 20 slices can be generated with:

maze = MazeND([40, 40, 20])

A 7D maze:

maze = MazeND([20, 20, 20, 10, 10, 20, 5])

Caution: generation time is proportional to np.prod(maze.grid.shape). This can quickly blow up for mazes with more than 4 dimensions.

Visualizing maze structures

The maze generation process can be visualized using examples/draw_maze.py:

poetry run python draw_maze.py 40 40

By default, this will save an image of the maze at examples/maze_image.png

Any number of shape dimensions can be passed. A 3D maze can be generated via:

poetry run python draw_maze.py 20 20 20

For mazes with dimension N > 2, 2D planes of the maze will be drawn separated by a vertical border. For an N-D maze, N-1 planes are shown.

The animation can be turned off using --skip-animation:

poetry run python draw_maze.py 40 40 --skip-animation

Fun color themes can be applied via --theme:

poetry run python draw_maze.py --theme beachy 40 40

Available themes are: default A boring, default maze

beachy, A beachy maze

woodsy, A woodsy maze

christmas, A festive, christmas maze

and kaboom. An explosive, kaboom maze

Metadata

Release files for maze-nd 0.1.1

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

Source distribution (sdist)

Source distribution for maze-nd 0.1.1
File Size Uploaded Provenance
maze_nd-0.1.1.tar.gz 6.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for maze-nd 0.1.1
File Interpreter ABI Platform
maze_nd-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / maze_nd-0.1.1.tar.gz

Download URL maze_nd-0.1.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
286a8781c712a659e2c2000dd5ccabac973ae60580ecd72139f41dbcee4a0ddb
BLAKE2b-256 checksum
How to use checksums
25c7a35d02b06c76852551c875cb0b6fbdd5cef2faa0bc39b03e821f45c17d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-36-generic

Release files / maze_nd-0.1.1-py3-none-any.whl

Download URL maze_nd-0.1.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
203ff13a693301639d99a10ef214476bdf2be5bc417de7475bbef83fda6283ab
BLAKE2b-256 checksum
How to use checksums
c6cc307bd05300dca6a90067cac3776a89f18d4406c1df4d226d26af97c84f27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-36-generic

Security for maze-nd 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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