Maze generation

Scott Bolte scott at craycos.com
Fri Dec 14 06:07:59 AEST 1990


> I am interested in software or algorithms 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.

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,"_.":" |"];}

		Scott

-- 
___________________________________________________________________________
Scott Bolte                 scott at craycos.com               +1 719 540 4186
Cray Computer Corporation, 1110 Bayfield Drive, Colorado Springs, CO  80906



More information about the Alt.sources.d mailing list