When code is a maze describes my 1988 IOCCC entry [1]
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,"_.":" |"];}
[1] https://tromp.github.io/pearls.html#maze
Very cool, thanks for sharing!
If, like me, you're trying to compile it, don't forget to set the
flag in gcc, so: Then run it as:Got seg fault (gcc 15.2.0 on nixos 26.05) when writing to
Had to add: and change to: Works now: