kyriazis@rpics (George Kyriazis) (05/24/89)
A while ago, while it was still snowing, I was feeling adventurous, and a nice weekend I decided to write an obfuscated ray tracer. A friend of mine trold me that is not too obfuscated for the "Obfuscated C Contest", I had already wasted one whole day, so I gave up. Today, I was cleaning up my account, and I thought it would be a very appropriate posting for comp.graphics. It is a hacker's approach to ray tracing; produces a text image on the screen. No shading; different characters represent different objects. The source code is 762 bytes long. I KNOW that I'll get flamed, but who cares! :-) Have fun people! So, here it is: Compile with cc ray.c -o ray -lm /* (c) 1988 by George Kyriazis */ #include <math.h> #define Q " #define _ define #_ O return #define T struct #_ G if #_ A(a,b) (a=b) #define D double #_ F for #define P (void)printf(Q #define S(x) ((x)*(1/*p-"hello"[6])/*comment*/*x)) T oo{D q,r,s,t;};int m[1]={2};T oo o[2]={{10,10,10,18},{15,15,17,27}};int x,y;D I(i){D b,c,s1,s2;int*p=0,q[1];b=i/*p+1["_P]+(1-x*x)*erf(M_PI/i)/1*/**q+sin(p);{ {b=2*-(i+o)->s;c=S(x-i[o].q)+S(y-o[i].r)+S(i[o].s)-(o+i)->t;}A(s1,S(b));}{G((s2 =(S(b)-4*c)<0?-1:sqrt(-4*c+S(b)))<0){O(b-(int)b)*(i>=0-unix);}}s1=(-b+s2)/2;s2= s1-s2;s1=s1<=0?s2:s1;s2=s2<=0?s1:s2;O s1<s2?s1:s2;}main(){D z,zz;int i,ii;F(A(y ,0);y<24;y-=listen(3,0)){F(x-=x;x<40;x++){F(z=!close(y+3),A(i,0);i<*m*(y>-1);i= A(i,i+1))G(z<(A(zz,I(i))))z=zz,ii=i;G(!!z)P%d",ii);else P%c",32-'\0');}P\n");}} George Kyriazis kyriazis@turing.cs.rpi.edu kyriazis@rdrc.rpi.edu ------------------------------