kxb@math.ksu.edu (Karl Buck) (04/29/91)
I'm trying to find algorithms for generating mazes. If anyone has information on this please email. Thanks. -- Karl Buck ** You know things are bad when you follow up to your own posts ** ** with spelling flames. ** KSU Dept. of Mathematics email: kxb@hilbert.math.ksu.edu Manhattan, Kansas 66506 voice: (913)532-6750
hammes@senf.informatik.uni-kl.de (Stefan Hammes (HiWi Mattern)) (04/30/91)
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 <stdio.h> 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<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];} Have fun, Stefan +---------------------------------------+-------------------------------------+ | Stefan Hammes | e-Mail: hammes@informatik.uni-kl.de | | FB Informatik, SFB 124-D1 +-------------------------------------+ | Universitaet Kaiserslautern, P.O.Box 3049, D-W6750 Kaiserslautern, Germany | +-------------+------------------------------------------------+--------------+ | Language definition: Recursion - see recursion | +------------------------------------------------+