In 1991, on a DOS machine with a BGI graphics driver, I wrote a small program that draw colored trees on screen. It wasn't meant to generate mazes. It became one by accident. Last weekend, 35 years and two rewrites later, I finally gave it a home in the browser.
How it started: trees, not mazes
The idea didn't begin as "let me build a maze generator." It began with drawing trees.
First came binary trees — each branch splitting into two. Then I moved to trees with three branches instead of two. At some point those three branches were arranged so they met at 45-degree angles from one another, and that's when it clicked: a tree that never crosses itself, that always has exactly one path from the root to any point on it, is a maze. A "perfect maze" is nothing more than a spanning tree with no cycles. I arrived at that property by drawing branches, not by studying graph theory.
What came out of that was a recursive backtracking routine: pick a point, grow a branch in one of several directions, recurse, and if a direction is blocked, back up and try another. This is, in retrospect, a randomized depth-first search — the same family of technique used by what's now widely known as the "recursive backtracker" maze algorithm. I want to be precise about what I'm claiming here, because it matters: I'm not claiming to have invented backtracking, or randomized DFS, or even maze generation via spanning trees. Backtracking as a formal technique goes back to D.H. Lehmer's work in the 1950s, and randomized DFS on a grid is a fairly natural thing for anyone to land on once they're generating trees programmatically. What I am saying is that I arrived at this specific approach independently, through a visual/geometric route rather than an algorithmic one, before I'd ever seen it written up as a named "maze generation algorithm" anywhere. The technique got its wider recognition in the developer community mostly through Jamis Buck's well-known 2010–2011 blog series cataloging maze algorithms — nearly twenty years after I'd written LABYR.PAS. That's the honest version of the story, and it's a more interesting one than a discovery claim: two people, two decades apart, arriving at the same idea from completely different directions.








