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

Coloring Your Mazes

It turns out that coloring mazes in a particular way acts like an X-ray machine, letting us peer inside and get a much clearer view of the structure of a maze and of the algorithm that generated it. Dijkstra’s algorithm is ideal for this, because of that matrix of numbers it generates. Every cell with the same distance value has one thing in common: they all are equidistant from the starting cell. This is just crying for a paint-by-number exercise.

The easiest way to do this is to treat each number as an intensity value, relative to the length of the longest path. It works even better if we invert the logic, too, treating the cells with the largest distance values as being darkest, and the cell that we started with (which ...

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