Skip to content

JohnnyDeuss/maze-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maze generator

Example maze

Generates randomized mazes.

Usage

CLI

The generator can be used as from the command-line using python3 -m maze_generator [options]

Options

Argument Value Default Description
--help/-h / / Show the help message and exit
--size/-s W H 30 20 The size of the maze in squares
--algoritm/-a best|breadth|ust ust The generation algoritms to use
--border px 4 The outer border thickness in pixels
--wall px 2 The inner wall thickness in pixels
--path px 20 The width of the pathway in pixels
--output/-o path maze.png The output file

Code

Mazes can be generated by calling any of the functions in the generators module: best_first, breadth_first and ust. Each of these generates a maze of a given size. The result is a 2D networkx grid graph, where each node is labeled with the position of the square, i.e. (x, y) tuples, and edges connect squares that have a path between them.

These graphs can be renedered with render.render_maze.

The default CLI maze generator would be equivalent to:

from maze_generator.generators import ust
from maze_generator.render import render_maze

maze = ust(30, 20)
img = render_maze(maze)
img.save("maze.png", "PNG")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages