Xref: utzoo comp.sources.wanted:16462 rec.games.misc:16169 comp.sources.d:6901 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!uunet!math.fu-berlin.de!ira.uka.de!sun.rhrk.uni-kl.de!senf.informatik.uni-kl.de!hammes From: hammes@senf.informatik.uni-kl.de (Stefan Hammes (HiWi Mattern)) Newsgroups: comp.sources.wanted,rec.games.misc,comp.sources.d Subject: Re: Maze generating algorithm wanted Message-ID: <1991Apr30.081143.523@rhrk.uni-kl.de> Date: 30 Apr 91 08:11:43 GMT References: <1991Apr29.072444.6116@maverick.ksu.ksu.edu> Sender: news@rhrk.uni-kl.de Reply-To: hammes@senf.informatik.uni-kl.de (Stefan Hammes (HiWi Mattern)) Organization: University of Kaiserslautern (Germany) Lines: 40 In article <1991Apr29.072444.6116@maverick.ksu.ksu.edu>, kxb@math.ksu.edu (Karl Buck) writes: |>I'm trying to find algorithms for generating mazes. If anyone has information |>on this please email. Thanks. I have found a fine little C-program sometime ago for generating mazes: /* Believe it or not the following C code can generate unique mazes of arbitrary size. Extract the code and compile it. When you run it just give a number, after you run it, not on the command line. I do not know where it came from but I have had it for at least a year. Scott Bolte scott@craycos.com +1 719 540 4186 Cray Computer Corporation, 1110 Bayfield Drive, Colorado Springs,CO80906 */ #include char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C); -- E; J[ E] =T [E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|" ) , A = 39 ,C -- ) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C & A == T[ A] |6<<27