Obfuscated C

This page is under construction, blah, blah, blah.

The next round's on me...

An idea by über-obfuscator Andrew Garrard. His, however, was more illuminating!
I like this one as I use a deliberately obfuscated traversal of the data

int c;d(x,y,a,b){(b/=2)||(a/=2)?d(x,y,a,b),b?(y+=b):(x+=a),d
(x,y,a,b):printf("%c"," .:oO@\nFatPhil"[a=x-32,b=y-16,x?(c+=
(b=500-a*a-b*b*4)>0?b:y)/99:6],c%=99);}main(){d(0,0,64,32);}


I could have resorted to using the preprocessor...

#define D d(x,y,a,b)/*Fat*/
int c;D{(b/=2)||(a/=2)?D,b?
(y+=b):(x+=a),D:printf("%c"
," .:oO@\n"/*Phil*/[a=x-32,
b=y-16,x?(c+=(b=500-a*a-b*b
*4)>0?b:y)/99:6],c%=99);}/*
1997*/main(){d(0,0,64,32);}


I can remove the traversal obfuscation, and it becomes rather boring, although a fair bit shorter

int c,a,x,y;main(){for(;a<2000;
c%=80)printf("%c"," .:oO@\n"[x=
a%80-40,y=a/80-13,c+=(x=400-x*x
-y*y*4)>0?x:0,a++%80?c/80:6]);}

An attractive basin...

A total rip off of a sig by Andrew Garrard. Maybe it's a male thing, but mine's shorter! Not at all obfuscated, unfortunately

#include <stdio.h>/* Ain't no such thing as the shortest code! 1997 PAPC */
main(c){float x,y=2,X,Y,Z,q=sin(time(0))*1.3,t=sqrt(1.69-q*q);  /* after */
for(;(x=-2)<(y-=.1);)for(c=0;Y=y,(X=x+=.05)<2;)for(c=printf("%c"/*   AWG */
,"\n .-:|O8H#"[c]);X*X+Y*Y<4&&++c<9;Z=q+X*X-Y*Y,Y=2*X*Y+t,X=Z);}/*respect*/

YAMS (yet another Mandelbrot sig)

A mixture between sigs by Andrew Garrard and Robert Harley.
I chose here to have a pretty region, hence it's fairly long. Robert's influence is obvious.

float x,y=-1.2,X,Y,Z;main(i){for(;X=Y=0,
x<.6?x+=.05,1:(i=72,x=-2,y+=.1)<1.2;)for
(i=printf("%c"," .-:|O8H#\nPC"[i/8]);X*X
+(Z=Y*Y)<4&&++i<71;X=X*X-Z+x)Y=2*X*Y+y;}

It may be shrunk using a less pretty region and less detail. Andrew's influence is evident.

/* PAPC  Who says there ain't no such thing as the smallest code.  Big Hi! */
/* after */main(c){float x,y=2,X,Y,Z;for(;(x=-2)<(y-=.1);)for(c=/* to Mats */
/*   AWG */0;Y=y,(X=x+=.05)<2;)for(c=printf("%c","\n .-:|O8M#"[c/* MegaSpy */
/*respect*/]);X*X+Y*Y<4&&++c<9;Z=x+X*X-Y*Y,Y=2*X*Y+y,X=Z);}/*!*//*  !!!!!  */

My IOCCC entry

This was my entry in the IOCCC last year.
Can you guess what it does?

main(int O,char**l){O-1&&main((O++<0?putchar(O%4?*1[l]++:",\n"[!O]):1[l][O-2])?O:2-4*O/3,l);}

World's largest prime

This is a rip off of Fabrice Bellard's winning IOCCC entry from last year (2000/2001). My version is over 30 bytes (about 7%) shorter.
 
#define P for(p=t;p<t+N;
int m=754974721,N,t[1<<22],*p,i,e=4625195,j,s,c,U;f(d){for(s=1<<23;s;d
=d*1LL*d%m,s/=2)if(s<N)P p+=s)for(i=s,c=1;i;i--)j=*p+p[s],p[s]=(m+*p-p
[s])*1LL*c%m,*p++=j%m,c=c*1LL*d%m;for(j=0;++i<N;){for(c=N/2;!((j^=c)&c
);c/=2);i<j?t[i]^=t[j]^=t[i]^=t[j]:0;}}main(){for(*t=2,U=N=1;e/=2;){U=
U*1LL*(m+1)/2%m;N*=2;f(362);P)*p++=*p*1LL**p%m*U%m;f(415027540);P)s+=*
p<<(e&1),*p++=s%10,s/=10;}for(--*t;p>t;)(e|=*--p)&&printf("%d",*p);}


Obfuscators

Andrew Garrard, watch out - he's going for the pot!
Robert Harley, the master of the Elliptic Curve!
Fabrice Bellard, beware his nifty transforms!


Back to sports games and pastimes, top FatPhil