Disgusting Code

Warren Burstein warren at pluto.UUCP
Fri Feb 14 03:51:06 AEST 1986


> A trade (Info-world? DecWorld?, DecProfessional?) published the
> results of the second annual "Obfuscated C-Code Contest"a couple of
> months ago.
> 
> At one time I had a copy of the article, and the first, second,
> third and honorably mentioned entries.  They were pretty disgusting.
> 
> I can't seem to find my copy of the article, but posting the results
> would stimulate the creative flow of juices in us all.
>
Here are two of them.  First and second prize aren't online since
one only runs on a VAX (went something like unsigned in main[] = {...})
and another didn't really do anything.

I found them in Micro/Systems Journal.

third place:
a[900];		b;c;d=1		;e=1;f;		g;h;O;		main(k,
l)char*		*l;{g=		atoi(*		++l);		for(k=
0;k*k<		g;b=k		++1)		;for(h=		0;h*h<=
g;++h);		--h;c=(		(h+=gh		*(h+1))		-1)1;
while(d		<=g){		++O;for		(f=0;f<		O&&d<=g
;++f)a[		b<<5|c]		=d++,b+		=e;for(		f=0;f<O
&&d<=g;		++f)a[b		<<5|c]=		d++,c+=		e;e= -e
;}for(c		=0;c<h;		++c){		for(b=0		;b<k;++
b){if(b		<k/2)a[		b<<5|c]		^=a[(k		-(b+1))
<<5|c]^		=a[b<<5		|c]^=a[		(k-(b+1		))<<5|c]
;printf(	a[b<<5|c	]?"%-4d"	:"    "		,a[b<<5
|c]);}		putchar(	'\n');}}

dishonorable mention (my favorite)

int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}

-- 
1 free, 2,999,999 to go



More information about the Comp.lang.c mailing list