The International Obfuscated C Code Contest
Results 1 to 4 of 4

Thread: The International Obfuscated C Code Contest

  1. #1
    Senior Member
    Join Date
    Feb 2004
    Posts
    620

    The International Obfuscated C Code Contest

    http://www0.us.ioccc.org/years.html

    This is a pretty entertaining page... The title says it all. It's an annual contest where people send in the most confusing code they can make. And believe me, there are some really whacky ones.

    Here's one I liked. It's the generic "hello world" program.

    Code:
    #include "stdio.h"
    #define	e 3
    #define	g (e/e)
    #define	h ((g+e)/2)
    #define	f (e-g-h)
    #define	j (e*e-g)
    #define k (j-h)
    #define	l(x) tab2[x]/h
    #define	m(n,a) ((n&(a))==(a))
    
    long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
    int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };
    
    main(m1,s) char *s; {
        int a,b,c,d,o[k],n=(int)s;
        if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
        else switch(m1-=h){
    	case f:
    	    a=(b=(c=(d=g)<<g)<<g)<<g;
    	    return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d));
    	case h:
    	    for(a=f;a<j;++a)if(tab1[a]&&!(tab1[a]%((long)l(n))))return(a);
    	case g:
    	    if(n<h)return(g);
    	    if(n<j){n-=g;c='D';o[f]=h;o[g]=f;}
    	    else{c='\r'-'\b';n-=j-g;o[f]=o[g]=g;}
    	    if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c;
    	    return(o[b-g]%n+k-h);
    	default:
    	    if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f;
    	    for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1);
    	}
    }
    I'm still trying to figure it out...

    Some of the codes on the site even look like ASCII art. Nice.

    mjk

  2. #2
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    I've always wanted a tutorial on how the contest entries manage to look so impossible. It just seems like completely bogus code half the time. :P

    ac

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Posts
    813
    Well after you've seen the Perl camel [there's a tee shirt on ThinkGeek.com] that is both ASCII art and real working code [if I remember corectly it actually prints out two camels or something] little can surprise you
    /\\

  4. #4
    They call me the Hunted foxyloxley's Avatar
    Join Date
    Nov 2003
    Location
    3rd Rock from Sun
    Posts
    2,528
    My brother has the PERL camel T-shirt, and if you enter the code as normal.........nothing.
    you have to enter the code in the same pattern as the camel.....well impressed with that.
    55 - I'm fiftyfeckinfive and STILL no wiser,
    OLDER yes
    Beware of Geeks bearing GIF's
    come and waste the day :P at The Taz Zone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •