Update: This script has been updated as of this newer article.
So, I thought it would be cool to create a program for my daughter that would generate mazes that she could print out and solve. Originally I was going to create a Windows program but I didn’t really feel like dealing with the windows GDI and printer quirks. Luckily for me, and all the other web developers in the world, web browsers happen to have printer support built in! I created a random maze generator in javascript, based on a modified version of Kruskal’s algorithm. This code is modeled roughly on the fast_maze program that can be found at https://nehe.gamedev.net written by smart_idiot. When I wanted to learn several years ago how maze generators worked, this was the algorithm learned. The maze generator requires a browser that supports HTML 5 and the ‘canvas’ element. This is basically any modern browser except Internet Explorer. (IE users can try to use excanvas.js but you’re on your own.) You can try it out here. You can also download the javascript for it here. Have fun.