Perfect Maze

My older son likes to solve mazes that I draw to him. It’s takes a bit effort to create larger mazes at least if you want them to be “perfect” mazes. A perfect maze is defined as a maze which has one and only one path from any point in the maze to any other point. It was pretty easy to write a piece of code that creates mazes automatically using the Depth First Algorithm.

Perfect Maze

Perfect Maze

I wrote a small Java Applet that creates a different level of mazes with each mouse click. I haven’t written an applet for years so now it was time to try out the latest features of the Java Runtime. Sun have introduced many improvements in the latest runtime updates (Java 6 Update 10). Now applet is run in a different thread then the browser itself so you can’t hang the browser when starting an applet.

One of the cool features is that you can even drag the applet outside from your browser and close the browser while having the applet still running. That could able nice solutions to be written in applet format.

I created a new page for my latest Maze Applet so go a head and try it out. It doesn’t have much interactive features. You can just create new mazes by clicking the left mouse button. If you have the latest Java Runtime you can also test the dragging by holding the ALT key and then dragging the applet out from the browser window.