Maze generation

David Cortesi cortesi at informix.com
Fri Dec 14 11:16:04 AEST 1990


In article <1990Dec13.190759.9297 at craycos.com> scott at craycos.com (Scott Bolte) writes:
>
>	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,"_.":" |"];}

Well, when I tried it on a NeXT it said, quote:
[crickhollow 71] cc maze.c -o maze
[crickhollow 72] maze
10
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Bus error

And no way am I gonna try to debug *that* thing...



More information about the Alt.sources.d mailing list