Re: [math-fun] Booby-trapped recursive codes
A large number of my early C programs -- in the '80s -- were amazingly obfuscated and incredibly slow. (But this was not intentional.) --Dan Hilarie wrote: << On 12 Nov 2009 at 14:15, Hilarie Orman wrote:
I entered the obfuscated C contest one year with a program that computed a prime sieve in an incredibly slow and non-intuitive manner.
_____________________________________________________________________ "It don't mean a thing if it ain't got that certain je ne sais quoi." --Peter Schickele
This was adapted from a Lisp program, algorithm credited to Conway. My obfuscated C program: #define c d= #define r while( #define a *j++ #define p int #define u *e++ #define n ); #define o ){ #define k(x) write(1,(d=(*++e**--e)x,&d), 1 #define l if( p f[] = { 4,6,0,7,0,3,7,0,1,2,6,0,2,7,0,8,0,1,8,0,9,0,2,5,0,10,0, 10,0,4,5,0,9,0,3,8,0,8,0,4,5,0,7,0,0,6,0,5,0,5,0,6,0,1,4,0,2,3,0, 1,0,2,3,0,0,3,5,0,0 },h[100000]={1,0},*m=h+1,*j,*e=f,d; main(o p *i; r!(c 0) o r(c ! d) && (p)(i=e)o r(p)(j=h) && d && *i o r*j && (c *i != a)n l c ! d) i++;}l i=m, ! d o r u n r u n }} r y(u,i-m) && m--n r *m++= u n m--; j=h; r a==1 n l e=f,!*--j o b(j-h n k(/2-2) n}}} y(e,i o r(*(j-i-1) = a) != e n return e;} b(g o l g o b (g/10 n k(*2+(g%10)) n}}
participants (2)
-
Dan Asimov -
Hilarie Orman