This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: Distribution paused by the project owner.
PyMazeBuilder
Generate perfect mazes with Python using a growing tree algorithm and dungeons with rooms connected by corridors.
Installation
pip install pymazebuilder
Maze
█████████████████████
█░░░░░░░░░█░░░░░░░░██
██░░░░░░░░█░█████░███
█░░░░░░░░░░░█░░██░░░█
█░░░░░░░░░█░█░█████░█
█░░░░░░░░░█░░░█░░░█░█
█░░░░░░░░░█████░█░█░█
███░░░░██░░░░░░░█░░░█
███░███████████████░█
█░░░█░░░░░█░░░░░░░░░█
█░███░███░█░█████████
█░█░░░███░█░█░░░░░░░█
█░█░███░█░█░█░█████░█
█░█░██░░█░█░░░█░░██░█
█░█░██░░█░█████░███░█
█░░░█░░░░░░░█░░░░░█░█
█░███░░░░░░░█░███░█░█
█░██░░█░░░░░█░█░░░█░█
█░███░█░█████░█░███░█
█░░░░░█░░░░░░░█░░░░░█
█████████████████████
Dungeon
█████████████████████
█████████████████████
█░░░░░░░░░░░░░░░░████
█░░░░██████████░░████
█░░░░█░░░░░░░░░░░████
█░░░░░░░░░░░░░█░░████
██░██████████░█░░████
██░██████████░█░░████
██░█████████░░░░░████
██░█████░░░░░░░██████
██░░░░░░░░██░░░██████
██░░██░░░░███████████
█░░░░░░░░░███████████
█░░░░░░░░░███████████
█░░░░░░░░░███████████
█░░░░░███████████████
█░░░░░███████████████
█░░░░░███████████████
█░░░░░███████████████
█████████████████████
█████████████████████
Generated data structure
{
grid: [
[
Cell {
x: 0,
y: 0,
exits: [],
blocked: true,
displayed: false,
visited: false
},
...
]
]
rooms: [
Room {
x: 0,
y: 0,
width: 0,
height: 0
}
]
}
Quick use
Example
Generate a maze
python main.py
Generate a dungeon
python main.py --type=dungeon
The built-in renderer is a simple ASCII renderer which prints the maze to the console.
from pymazebuilder.generators.generator_manager import GeneratorManager
from pymazebuilder.generators.maze import MazeGenerator
from pymazebuilder.renderer import Renderer
data = GeneratorManager(
[
{
"generator": MazeGenerator,
"options": {"width": 10, "height": 10, "floors": 1},
},
]
)
data.generate()
Renderer(data)
Randomization
utils.py contains a random class which handles all random number generation and can be seeded.
Generator classes
Generator classes can be passed as an optional array of objects to the maze generator.
The shape of this data structure is as follows:
[
{
generator: <generator class>,
options: <options object>
},
...
]
Generator (src/pymaze/generator.py) will iterate over each generator class and instantiate it.
Example
The following example shows how to generate a maze with rooms using the provided room generator.
(also see src/pymaze/main.py)
from pymazebuilder.generators.generator import Generator
from pymazebuilder.generators.renderer import Renderer
Generator([
{
'generator': MazeGenerator,
'options': {
...
}
},
{
'generator': RoomGenerator,
'options': {
...
}
},
{
'generator': StairsGenerator,
'options': {
...
}
}
])
Renderer(generator)
Multi-floor maze
Use the floors option to generate a multi-floor maze.
Use the src/generators/stairs.py generator to connect the floors with stairs.
Floor 0
█████████████████████
█░██░░░░░██░░░░░░░░░█
█░███░█░███░░░░░█░█░█
█░░░█░█░░░░░█░░░█░█░█
███▼█░█░█████████░█░█
█░░░█░█░░░█░░░░░█░███
█░███░███░█░███░█░███
█░█░░░░██░█░█░░░█░░░█
█░█░█████░█░█░█░█░░░█
█░█░░░░░█░███░█░█░░░█
█░█░░██░█░███░█░█░░░█
█░█░░░█░█░░░░░█░░░█░█
█░███░█░███░░░░░█░█░█
█░██░░█░░░░░░░█░░░█░█
█░███████████░█░███░█
█░░░█░░░█░░░█░░░█░░░█
███░█░█░█░█░█████░█░█
███░░░█░█░█░░░░░░░█░█
█░█████░█░███░░░░░█░█
█░░░░░░░░░██░░░░░░░░█
█████████████████████
Floor 1
█████████████████████
█░░░░░░░░░█░░░░░░░░██
██░░░░░░░░█░█████░███
█░░░░░░░░░░░█░░██░░░█
█░░▲░░░░░░█░█░█████░█
█░░░░░░░░░█░░░█░░░█░█
█░░░░░░░░░█████░█░█░█
███░░░░██░░░░░░░█░░░█
███░███████████████░█
█░░░█░░░░░█░░░░░░░░░█
█░███░███░█░█████████
█░█░░░███░█░█░░░░░░░█
█░█░███░█░█░█░█████░█
█░█░██░░█░█░░░█░░██░█
█░█░██░░█░█████░███░█
█░░░█░░░░░░░█░░░░░█░█
█░███░░░░░░░█░███░█░█
█░██░░█░░░░░█░█░░░█░█
█░███░█░█████░█░███░█
█░░░░░█░░░░░░░█░░░░░█
█████████████████████
▲ = stairs going up
▼ = stairs going down
█ = wall
░ = floor
Custom generator classes
Custom generators should match the following pattern.
class SomeGenerator:
def __init__(data: dict, options: dict):
# do something with the data object
self.data = data
self.data["some_property"] = "some value"
See src/pymaze/room.py and src/pymaze/maze.py for complete examples along with a list of optional arguments that each class takes.
License
Contributors
Metadata
Release files for pymazebuilder 1.4.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymazebuilder-1.4.6.tar.gz | 12.8 kB | Without provenance | Details for pymazebuilder-1.4.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymazebuilder-1.4.6-py3-none-any.whl | Python 3 | none | any | Details for pymazebuilder-1.4.6-py3-none-any.whl |
Total release size: 28.1 kB
Release files / pymazebuilder-1.4.6.tar.gz
| Download URL | pymazebuilder-1.4.6.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
badd1cf8e59cccb3e05588c7486ec890298bbed99a2d19103c49f3ede9a91018
|
|
BLAKE2b-256 checksum How to use checksums |
cddc8a586d52a071ac1314214f04af079f1c1ce971b9fd361ab955bac98255bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pymazebuilder-1.4.6-py3-none-any.whl
| Download URL | pymazebuilder-1.4.6-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ce7c8422d5dd96096c8f4e7d8688f4a019538ca349c19e195c4832862805b70
|
|
BLAKE2b-256 checksum How to use checksums |
90dccb25ebda161081de95a69e4bae88978d68a96436f8aed2ea4eaabaf54f27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Security for pymazebuilder 1.4.6
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.