Skip to Main Content
Mazes for Programmers
book

Mazes for Programmers

by Jamis Buck
July 2015
Intermediate to advanced content levelIntermediate to advanced
286 pages
6h 31m
English
Pragmatic Bookshelf
Content preview from Mazes for Programmers

Generating Weave Mazes

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 ironed out, we’ll work on a new Grid subclass with some more to_png tweaks, so we can draw these new tunneling passages.

To get an idea of how these new passages work, let’s take a minute and glance back at Figure 5, A Weave Maze. 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.

A passage cannot dead-end over or under another passage.
This prevents confusion that could happen when a passage seems ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Exercises for Programmers

Exercises for Programmers

Brian P. Hogan

Publisher Resources

ISBN: 9781680501315Errata Page