2 ms·
The author actually says: it's not the dumbest way, because it does find a solution. Here's the most obfuscated way to generate a maze. Compile char*M,A,Z
by tromp 4y ago
The author actually says: it's not the dumbest way, because it does find a solution.
Here's the most obfuscated way to generate a maze.
Compile
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,"_.":" |"];}
with clang -fwritable-strings -Wno-implicit-function-declaration and enter a desired height. Gcc no longer accepts the -fwritable-strings option, so we can alternatively avoid writable strings by making the top line one character longer:
char M[3],A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf("%d",&C);