Search⌘ K
AI Features

Generating Weave Mazes

Explore how to generate weave mazes by extending grid frameworks to handle overlapping passages through phantom under-cells. Understand key rules for over-under tunnels, and implement maze designs that incorporate braiding and weaving techniques with cost-aware pathfinding.

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.

An example of a passage dead-ending under another passages
An example of a passage dead-ending under another passages

This prevents confusion that could happen when a passage seems to disappear beneath another one. ...