Skip to content

The turtle draws a maze as two separate trees. First finds the longest possible line, then the shorter lines "grow" from it like branches. It's a pretty nice view.

Notifications You must be signed in to change notification settings

tomaszbar9/maze_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maze Generator

Python code generating and drawing a rectangular maze with given number of rows and columns.

The program uses the turtle module for drawing. It treats all the maze's lines as if they were two separate trees or graphs, and the drawing method follows that idea. First, the "trunks" are found, which are the longest possible line of each tree. Then, the turtle draws the longer trunk, and the rest of the lines grows from consecutively it as its branches, gradually filling the whole maze up.

The generator does not use recursion at all, so there is no size limit (at least when it comes to the program itself).

Since the only third-party libraries used during the development were pytest and pre-commit, the program does not require any external modules to run.

Usage

git clone https://github.com/tomaszbar9/maze_generator
python -m maze generator [--help] [-s | --size <width> <height>]
                         [-c | --cell <size>] [--slow] [--close]
maze_generator.mp4

About

The turtle draws a maze as two separate trees. First finds the longest possible line, then the shorter lines "grow" from it like branches. It's a pretty nice view.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages