Skip to main content

python-maze

Generates a PNG maze. Thanks to Orestis Zekai for the original algorithm.

Included Maze Types

Line maze

  • Grid with separate wall segments
  • Generates 2 PNGs -- one solved, one unsolved
  • Every grid square is usable as a maze cell
  • Can make more interesting maze generation by adding iterations
    • Iteration is currently very simple -- it's set to maximize the length of the solved path
  • Smart Mode: Turn on for generating smarter mazes, that make up more of the area
  • Usage:
usage: line_maze.py [-h] [-H HEIGHT] [-W WIDTH] [-S] [-I ITERATIONS]

optional arguments:
  -h, --help            show this help message and exit
  -H HEIGHT, --height HEIGHT
                        how high to make the maze
  -W WIDTH, --width WIDTH
                        how wide to make the maze
  -S, --smart           optimize the maze by being smart
  -I ITERATIONS, --iterations ITERATIONS
                        how many times to try

Multithreaded Line Maze Generator

  • Generates line mazes, using smart mode
  • May melt CPU's
  • Defaults are:
    • 50 by 50 maze
    • iterated 100 times
    • 10 threads
  • Currently the best maze generator in this repo.
  • Usage:
usage: multithreaded_maze.py [-h] [-H HEIGHT] [-W WIDTH] [-I ITERATIONS] [-T THREADS]

optional arguments:
 -h, --help            show this help message and exit
 -H HEIGHT, --height HEIGHT
                       how high to make the maze
 -W WIDTH, --width WIDTH
                       how wide to make the maze
 -I ITERATIONS, --iterations ITERATIONS
                       how many times to try
 -T THREADS, --threads THREADS
                       how many threads to spawn

Line Maze Example:

A Line Maze generated using multithreading

Line Maze Example:

The solution of the line maze above

Square maze

  • Kept for historical purposes only. Don't use this. It probably doesn't even work.
  • Grid
  • Solving/Optimization isn't working yet
  • Uses grid squares for walls
  • Usage: python square_maze.py <maze_height> <maze_width>

Fair warning:

This code is horribly inefficient, and large mazes take quite a long time to generate, especially if they are run through many iterations

Release files for python-maze-generator 1.0.3

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

Source distribution (sdist)

Source distribution for python-maze-generator 1.0.3
File Size Uploaded
python_maze_generator-1.0.3.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-maze-generator 1.0.3
File Interpreter ABI Platform
python_maze_generator-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / python_maze_generator-1.0.3.tar.gz

Download URL python_maze_generator-1.0.3.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b80c96a7061df1f94d694b71e981ffc90b0d72c547ee2adf16fa55d7e3c4fced
BLAKE2b-256 checksum
How to use checksums
eb9e99720a14cfd696c38d6805964809089739a12061c30a57c6f1868ee10403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.7

Release files / python_maze_generator-1.0.3-py3-none-any.whl

Download URL python_maze_generator-1.0.3-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e9d611008daf579ae22059aead1645250ad7b13dd8420de451351d61018ebfc
BLAKE2b-256 checksum
How to use checksums
171a2bf4bfd27fe06bc4bebb57ccc61504bacead2c535c743fd9aedd4cfc2a55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.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