Special

Special Print Closeout!

We're clearing out the remainder of our print issues at fire sale prices -- as much as 75% off! Quantities are extremely limited and only available while supplies last. Hurry to take advantage of this one-time offer.

RBD Magazines

Once these printed back issues are gone, they are gone!

Article Preview


Buy Now

Print:
PDF:

Feature

Maze Generation

How to Get Lost in Your Work

Issue: 3.6 (July/August 2005)
Author: Joe Strout
Author Bio: Joe always loved mazes as a child, and spent many long hours generating them by hand, the dolt.
Article Description: No description available.
Article Length (in bytes): 9,897
Starting Page Number: 18
RBD Number: 3610
Resource File(s):

Download Icon 3610.sit Updated: Monday, July 25, 2005 at 11:26 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

Mazes are one of those simple puzzles that have been enjoyed throughout history. For most of that history, designing a maze required a lot of careful work. Nowadays, we can let our computers do the grunt work for us. In this article, we'll see how to write REALbasic code that automatically generates a maze of any size and shape we like.

Let's start by considering some of the properties of a good maze. It should certainly be solvable; that is, there must be a path from the start location to the goal location. More generally, it should probably be possible to get from any point in the maze to any other. However, it shouldn't be too easy; there should be only one or a few ways to get from point A to point B.

For a maze composed of square cells, each cell has four walls (ignoring for now the edge cells around the outside of the maze). However, each wall is shared between two cells -- assuming we don't want to support one-way doors -- so really, there are two walls per cell. In the code for this article, I'll assume that a cell "owns" the walls above and to the left of that cell.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com