Article View: rec.games.programmer
Article #474Re: WANTED : Maze Algorithm extension
From: Phat H Tran
Date: Fri, 07 Aug 1992 08:07
Date: Fri, 07 Aug 1992 08:07
38 lines
2458 bytes
2458 bytes
In article <1992Aug6.225108.572@ccu1.aukuni.ac.nz> rossw@ccu1.aukuni.ac.nz (Ross Williamson) writes: > OK a slight extension to the question I asked. >I also want every possible room to be connected ...... >And I don't want to enter the maze from one point and exit at another >I just need it so that it generates a set of connections between all >rooms :( it's a bit of a dog but it's something I need to solve. > >Can anyone help at all ?? > >+-----------------------------------------+--------------------+ >| Name : Ross Williamson |Auckland University | >| E-Mail : rossw@ccu1.aukuni.ac.nz | New Zealand | >| Of course these opinions are my own and thank !! for that | >+--------------------------------------------------------------+ >"Oh Zaphod he's in his cabin signing photos of himself, 'To >myself with frank admiration" Arthur Dent - From the Hitchhikers >Guide To The Galaxy. There was a very good maze generating algorithm for my TI-99. It sets up an array, chooses a corner, then starts doing two-step random walks, placing a direction marker at each step. The random walk would avoid any square that has already been stepped on, or any that are outside the dimensions of the array. If the program finds itself trapped in a dead-end, where no more steps can be taken without stepping on a pre- trampled square, then it would retrace its steps, using the directional markers to guide it, and look for the first place where it can branch out. Then it would continue walking randomly off that branch, until it again arrives at a dead-end, where the whole process repeats itself. Remember when implementing this algorithm to always take two consecutive steps in the same direction, even when back-tracking. This algorithm fills up an array with passageways, and it guarantees that there can only be one path from one point in the maze to another. I've used it to generate huge 2D mazes, which I printed out and gave to my siblings to solve. Hope this helps. Phat.
Technical Details
Message-ID:
<BsLt8y.9t1@watserv1.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!ptranReferences:
<1992Aug6.225108.572@ccu1.aukuni.ac.nz>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!ptran From: ptran@watserv1.uwaterloo.ca (Phat H Tran) Subject: Re: WANTED : Maze Algorithm extension Message-ID: <BsLt8y.9t1@watserv1.uwaterloo.ca> Organization: University of Waterloo References: <1992Aug6.225108.572@ccu1.aukuni.ac.nz> Date: Fri, 7 Aug 1992 08:07:45 GMT Lines: 39