3 ms·
Very cool, thanks for sharing! If, like me, you're trying to compile it, don't forget to set the -std=gnu89 flag in gcc, so: gcc -std=gnu89 -w -o ma
by ghgr 13d ago
Very cool, thanks for sharing!
If, like me, you're trying to compile it, don't forget to set the
-std=gnu89
flag in gcc, so:
gcc -std=gnu89 -w -o maze maze.c
Then run it as:
echo 10 | ./maze
- wumms 13d agoGot seg fault (gcc 15.2.0 on nixos 26.05) when writing to M[Z] = ... Had to add: char fmt[] = "%d"; and change to: scanf(M=fmt,&C); Works now: char*M,A,Z,E=40,J[40],T[40];main(C){char fmt[]="%d";for(*J=A=scanf(M=fmt,&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,"_.":" |"];}