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.

Leave a Reply

Your email address will not be published. Required fields are marked *