Recursive Backtracking, Animated

A couple of weeks ago I described the recursive backtracking algorithm for generating mazes. Here’s an animation of the generation of a maze using recursive backtracking. As you can see, the maze begins as an array of unconnected little rooms, and grows room by room from one starting room.


  • By Marie, November 21, 2012 @ 7:20 pm


  • By Mark Lambert, November 23, 2012 @ 7:09 am

    This is way cool! Don’t understand it, but it sure is fun to watch! Now if the final product would only stay for more than a split second before it jumps to the next maze…

  • By Mark Lambert, November 23, 2012 @ 7:15 am

    My bad. I just realized that it keeps building the same maze over and over again.

  • By Will Duquette, November 23, 2012 @ 12:46 pm

    It’s just a GIF image; if you save it to disk and open it in an image editor, you can probably see all of the frames individually.

  • By karrde, November 24, 2012 @ 6:00 am

    I like it.

    If the browser renders it at the right speed, (and I watch often enough), I can follow the algorithm as it plays out.

Other Links to this Post

WordPress Themes