v04i110: An amazingly small C-program

Robert E. Stampfli res at cbnews.ATT.COM
Sat Oct 8 08:09:43 AEST 1988


>In article <751 at mcrware.UUCP> jejones at mcrware.UUCP (James Jones) writes:
>>I include the source here for reference--it's very short:
>
>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,"_.":" |"];}
  ^^^^^
>

When I tried compiling this, it didn't work, generating mazes which were
always columnar except for one horizontal row at the bottom.

However, by changing the "6<<27" to "4<<11" I found it worked
for my "big-endian" type machines.  The rand() function returns a
number in the range 0 - 2^15-1 on my systems, making the program 
always fail the comparison, as originally written.  Other systems
may have slightly different rand() functions, I suppose.  Regardless,
this is one jewel of a program.  Hope this helps someone.

Rob Stampfli
att!cbnews!res



More information about the Comp.sources.bugs mailing list