[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Maze




And a much simpler one (if I can get it from memory this early
in the morning):

Start with all walls filled in, all cells "unmarked" except one.

Pick a marked cell at random, pick a wall at random that leads to an
unmarked cell, knock down the wall, mark the cell.

Repeat until you mark all the cells.

Then there's one and only one way from any cell to any other cell.
Create arbitrary entrance and exit, and you're done!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe