Update to the maze generator

I’ve updated the maze generator so you can now generate and navigate a 3D maze. The actual maze navigation part is written in dynamically generated javascript; you can save the generated HTML which will also save the maze itself, then play it back offline if you feel so inclined.

Just as the original program was my first really major PHP project, the javascript now incorporated into the script (and comprising about half the code) is my first significant javascript program. I will concede it’s not actually all that well written.

Still, given I knocked the javascript code and associated changes to the PHP code together in around 8-10 hours I think it’s adequate.

Source code is here. Maze page is there.

Mazes

Ever since I was a kid I’d had an odd fascination with mazes. Used to buy books of the things. After a while I started getting more interested in generating rather than solving them.

Waaaaay back in high school I wrote a simple maze generating program on my Z80-based VZ-200 (in BASIC). Later I revamped this on my Amiga and recoded it to show a 3D viewpoint.

Since I’m at loose ends and need to keep my coding skills sharp, I’ve revisited that old project and written a modern variant in PHP. The new version also has several options for hex-based (rather than rectangular grid) mazes; the programs written back in my school/university days lacked that option.

I’ll probably be adding a few additional features over the next week or two:

  • Add a 3D view, as well as an ability to navigate it.
  • Allow the 3D view to navigate a maze with three actual dimensions (i.e. three spatial coordinates). Also probably an option to have the 3D mazes avoid vertical connections where possible, as my old Amiga work demonstrated that people aren’t well equipped to navigate 3D spaces.
  • Eventually do the same for a 4D space. Navigating a hypercube strikes me as irredeemably cool.

I might also rejig the code into perl and/or python as an exercise in language familiarity.

This is actually the first major piece of PHP code I’ve written. In the past I’ve modified and hacked other peoples’ PHP code for various things, but this is my first project written from scratch. Fortunately PHP is a part of the same language family as C, perl and awk, all of which I know passably well.

It took about ten hours to code, which isn’t bad for a 400+ line debugged program in an unfamiliar language.

If you want to poke around the link is in the link bar, or else you can find it here.