Generating Weave Mazes

Learn four important rules that help in unambiguously generating weave mazes.

Background

It turns out that generating weave mazes isn’t all that different from generating normal mazes. The trick is figuring out how to represent those passages that tunnel underneath the others. Once we’ve got those worked out, we’ll work on a new Grid subclass with some more to_png tweaks, so we can draw these new tunneling passages.

Rules for generating weave mazes

We need to pay attention to how and when the passages weave over and under each other. It’s not entirely arbitrary—there are four important rules that make this work unambiguously.

Rule 1

A passage cannot dead-end over or under another passage.

Get hands-on with 1200+ tech skills courses.