Skip to content
A suite of functions for maze generation in python, as well as some tools for controlling a maze-navigating robot over Bluetooth.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



1. About

This is a suite of Python functions that can be used to generate mazes and produce maze images. There's also some functionality included to control a Parallax Scribbler robot over Bluetooth, part of a project I worked on.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

2. Instructions

The core functions are in They are:

Maze generation functions -- create perfect (no loops or inaccessible areas) mazes stored in a 2D array. Good explanations of these algorithms are available at:
mazegen_rb() -- Recursive backtracking algorithm
mazegen_kruskal() -- Kruskal's algorithm
mazegen_prim() -- Prim's algorithm

Maze solving function -- uses "wall following" to draw a solution path on the maze array.

Maze image generation -- prints a maze array to maze.png
mazedraw() -- prints arrays stored in the following format: 1:wall, 0 or 0.5:open space, 2:exit cell, 3:entrance cell, -1:solution (first pass), -2:solution(second pass, i.e. if the solution algorithm has been there twice)

Misc operations
cleanmaze() -- removes solutions and various junk from generation algorithms

3. Other things

There are a few functions for robot control:, that connect with an Anoto pen running an external socket to receive the location of the pen on dot matrix paper (used for robot navigation). uses the myro library to move a Parallax robot to a location determined by the Anoto pen and dot matrix paper arranged in a maze configuration. generates a maze that would be implemented with dot matrix paper and returns the correct information for use with, are examples of the system in action.
Something went wrong with that request. Please try again.