Ah, right!!! I totally forgot about that! That should help tremendously for big mazes. I was actually pleasantly surprised by how fast this one cranked out a small maze. I thought I would be waiting and waiting for it to find a valid wall to break. Congratulations to you and your son! I married at 22 and am still married 16 years later with 4 kiddies, and the first one just got her learner's permit! Time flies! -- Glenn Clifford Heath wrote: > Glenn M. Lewis wrote: > >> In honor of Clifford's very clear description of his maze-generation >> algorithm, here is my attempt at a solution, and an example output: > > > That's even cuter than I expected it to be - well done! > > Note that you don't use a circular search, so especially > with large mazes, your random choice is going to take > longer and longer to find a valid wall. You should choose > a starting position, then choose an order in which to > check the two walls, check them both, and if that fails, > don't choose a new random starting position but step to > the very next cell and check the walls again (same or > different random order is ok). Otherwise there's a real > possibility of *very* long runtimes. For example, to break > the last wall in a 20x20x20 maze, your random algorithm > has to loop until it finds one of 167200 candidate walls > out of a field that might be as small as three walls. > > Thanks for your kind comments. Let's hope my son is as good > at relationships! He announced his engagement yesterday, at > the age of 19... I can't complain, I married at 21 and still > am now... ;-). > > Clifford.