ftw!
Home Blog Archives RSS
¶ mazes
When I was in elementary school, we played with mazes a lot. For some reason, they were just fun. You know, start from one corner, and work your way out to the opposite corner. I was pretty good at them, usually faster than the other kids. My reasoning for this was my methodology. I would always start from the exit of the maze, and work my way back to the beginning. Somehow, it always got me there faster, but I never knew why. Well, not always, but most of the time.

I started thinking about that the other day and came up with this explanation. If I gave you a giant n-ary tree, drawn on a big piece of paper, and told you to draw me the path from the root node to any given leaf node, you would probably start from the leaf node and work your way up to the root. Like, you could start from the root and work your way down to the leaf node, but you might take a wrong branch and have to backtrack, whereas going from the leaf node up is a sure thing.

So if you think of a maze as a tree data structure rooted at the maze entrance, and dead ends and the maze exit all being leaf nodes, then it makes sense to start from the exit and work your way up the tree to the start.

Of course, that would only work if an amateur designed the maze. At least, that's how I used to do my mazes. I would always start by drawing a box, then drawing a random path from the start to finish, and then fill in the maze by drawing branches off of that random path. And I'll bet it looked suspiciously like a nice branching tree.

A good maze designer would make mazes that end up looking more like arbitrary graphs than trees. Drawing it out as a tree wouldn't help you at all cause you'd have no notion of parents and children. What would make the most sense is if you drew two trees, rooted at the start and finish, and connected them in the middle of the maze. That way, starting from either end wouldn't help you at all.



Re: mazes
Posted 21 years, 10 months ago by amandine • @Reply
your brain works in mysterious ways...



Comments disabled until the spammers go away. I hope you comment spammers all die horrible deaths and are forced to delete endless streams of comment spam in your days in purgatory.
• Powered by bBlog