Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site nsc.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!nsc!chongo From: chongo@nsc.UUCP (Landon Noll) Newsgroups: net.lang.c Subject: Winners of 1985 International C Code Contest Message-ID: <3504@nsc.UUCP> Date: Wed, 2-Apr-86 07:36:57 EST Article-I.D.: nsc.3504 Posted: Wed Apr 2 07:36:57 1986 Date-Received: Sat, 5-Apr-86 11:27:02 EST Organization: Rational Swamiconductor, Sanivale Lines: 125 Keywords: 1985,obfuscate,contest Since people often request the previous year's winners at the start of the contest, I include the 1985 winners below. Please keep in mind that the rules have changed between 1985 and 1986. ------------------------------------------------------------------------ The following programs were judged good (bad? wierd?) enough to win awards. This year, rather than trying to rank the programs in order of obfuscatedness, we gave a single award in each of 4 categories and a grand prize. ________________________________________________________________________ 1. The most obscure program: (submitted by Lennart Augustsson ) #define p struct c #define q struct b #define h a->a #define i a->b #define e i->c #define o a=(*b->a)(b->b,b->c) #define s return a;}q* #define n (d,b)p*b;{q*a;p*c; #define z(t)(t*)malloc(sizeof(t)) q{int a;p{q*(*a)();int b;p*c;}*b;};q*u n a=z(q);h=d;i=z(p);i->a=u;i->b=d+1;s v n c=b;do o,b=i;while(!(h%d));i=c;i->a=v;i->b=d;e=b;s w n o;c=i;i=b;i->a=w;e=z(p);e->a=v;e->b=h;e->c=c;s t n for(;;)o,main(-h),b=i;}main(b){p*a;if(b>0)a=z(p),h=w,a->c=z(p),a->c->a=u,a->c->b=2,t(0,a);putchar(b?main(b/2),-b%2+'0':10);} ________________________________________________________________________ 2. The worst abuse of the C preprocessor: (submitted by Col. G. L. Sicherman ) #define C_C_(_)~' '&_ #define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n') #define C_C _|_ #define b * #define C /b/ #define V _C_C( main(C,V) char **V; /* C program. (If you don't * understand it look it */ up.) (In the C Manual) { char _,__; while (read(0,&__,1) & write((_=(_=C_C_(__),C)), _C_,1)) _=C-V+subr(&V); } subr(C) char *C; { C="Lint says "argument Manual isn't used." What's that mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+ '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1)); } [ This program confused the C preprocessor so badly that it left some comments in the preprocessed version. Also, lint DID complain that "argument Manual isn't used". ] ________________________________________________________________________ 3. The strangest appearing program: (submitted by Ed Lycklama ) #define o define #o ___o write #o ooo (unsigned) #o o_o_ 1 #o _o_ char #o _oo goto #o _oo_ read #o o_o for #o o_ main #o o__ if #o oo_ 0 #o _o(_,__,___)(void)___o(_,__,ooo(___)) #o __o (o_o_<<((o_o_<<(o_o_< ) main(v,c)char**c;{for(v[c++]="Hello, world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);} ________________________________________________________________________ 5. The grand prize (most well-rounded in confusion): (submitted by Carl Shapiro ) #define P(X)j=write(1,X,1) #define C 39 int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N, *d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0; s<4;s++)if((k=m[s]+g)>=0&&k=16!=M[k]>=16)) a[f++]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=jb++?b[-1]:e;}P(" ");for(s=C;--s; P("_"))P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2)) P("| "+(*u/4)%2);} [As submitted, this program was 3 lines (2 of defines and 1 of code). To make news/mail/etc. happy we split the last line into 7. Join them back without the newlines to get the original version] ---------------------------------------------------------------------- Congratulations to the winners (and anyone else who wasted their time creating such wierd programs). For your own enjoyment, you can figure out what these programs do. Or if this is too hard, compile and run them! All of these compiled and ran on the vax. Lint was even happy with most of the entries. chongo <1985> /\cc/\