Polls

How Is My Site?

View Results

Loading ... Loading ...
June 12th, 2008 personal 6 Comments

International Obfuscated C Code Contest

The International Obfuscated C Code Contest (abbr. IOCCC) is a programming contest for the most creatively obfuscated C code held annually since 1984. The goal is thus to create the most complex and complicated logic for a possibly simple execution!!

There are many winning entries each year, and each entry gets a category such as “Worst Abuse of the C preprocessor” or “Most Erratic Behavior”.

The IOCCC was started by Landon Curt Noll and Larry Bassel. They were talking together about the horrible code it was their jobs to maintain and this led to an idea. They decided to hold a contest for the worst possible C code!

Within the only limit being the code size to a few kilobytes, the contestants manage to do complicated things.A 2004 winner turned out an operating system.

Some quotes from 2004 winners include:

To keep things simple, I have avoided the C preprocessor and tricky statements such as “if”, “for”, “do”, “while”, “switch”, and “goto”.
We still aren’t sure whether or not this is a useful program, but it’s the first atomic fission we’ve seen in the IOCCC.
Why not use the program to hide another program in the program? It must have seemed reasonable at the time.
The program implements an 11-bit ALU in the C preprocessor.
I found that calculating prime numbers up to 1024 makes the program include itself over 6.8 million times.

Below is a 1988 entry which calculates pi by looking at its own area:

  1. #define _ -F<00||–F-OO–;
  2.  
  3. int F=00,OO=00;
  4.  
  5. main()
  6. {
  7.         F_OO();
  8.         printf("%1.3f\n",4.*-F/OO/OO);
  9. }
  10.  
  11. F_OO()
  12. {
  13.             _-_-_-_
  14.        _-_-_-_-_-_-_-_-_
  15.     _-_-_-_-_-_-_-_-_-_-_-_
  16.   _-_-_-_-_-_-_-_-_-_-_-_-_-_
  17.  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  18.  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  19. _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  20. _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  21. _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  22. _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  23.  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  24.  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  25.   _-_-_-_-_-_-_-_-_-_-_-_-_-_
  26.     _-_-_-_-_-_-_-_-_-_-_-_
  27.         _-_-_-_-_-_-_-_
  28.             _-_-_-_
  29. }

Another good example is this clever flight simulator, the winner of the IOCCC in 1998 as shown below:

  1.  
  2. #include
  3. #include
  4. #include
  5. #include
  6.                                           double L ,o ,P
  7.                                          ,_=dt,T,Z,D=1,d,
  8.                                          s[999],E,h= 8,I,
  9.                                          J,K,w[999],M,m,O
  10.                                         ,n[999],j=33e-3,i=
  11.                                         1E3,r,t, u,v ,W,S=
  12.                                         74.5,l=221,X=7.26,
  13.                                         a,B,A=32.2,c, F,H;
  14.                                         int N,q, C, y,p,U;
  15.                                        Window z; char f[52]
  16.                                     ; GC k; main(){ Display*e=
  17.  XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0))
  18. ; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400,
  19. 0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6}
  20. ; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B=
  21. sin(j); a=B*T*D-E*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E
  22. *T*B,E*d/K *B+v+B/K*F*D)*_; p K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K
  23.  *D; N-1E4&amp;&amp; XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M;
  24.   XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){
  25.                                    XEvent z; XNextEvent(e ,&amp;z);
  26.                                        ++*((N=XLookupKeysym
  27.                                          (&amp;z.xkey,0))-IT?
  28.                                          N-LT? UP-N?&amp; E:&amp;
  29.                                          J:&amp; u: &amp;h); –*(
  30.                                          DN -N? N-DT ?N==
  31.                                          RT?&amp;u: &amp; W:&amp;h:&amp;J
  32.                                           ); } m=15*F/l;
  33.                                           c+=(I=M/ l,l*H
  34.                                           +I*M+a*X)*_; H
  35.                                           =A*r+v*X-F*l+(
  36.                                           E=.1+X*4.9/l,t
  37.                                           =T*m/32-I*T/24
  38.                                            )/S; K=F*M+(
  39.                                            h* 1e4/l-(T+
  40.                                            E*5*T*E)/3e2
  41.                                            )/S-X*d-B*A;
  42.                                            a=2.63 /l*d;
  43.                                            X+=( d*l-T/S
  44.                                             *(.19*E +a
  45.                                             *.64+J/1e3
  46.                                             )-M* v +A*
  47.                                             Z)*_; l +=
  48.                                             K *_; W=d;
  49.                                             sprintf(f,
  50.                                             "%5d  %3d"
  51.                                             "%7d",p =l
  52.                                            /1.7,(C=9E3+
  53.                               O*57.3)%0550,(int)i); d+=T*(.45-14/l*
  54.                              X-a*130-J* .14)*_/125e2+F*_*v; P=(T*(47
  55.                              *I-m* 52+E*94 *D-t*.38+u*.21*E) /1e2+W*
  56.                              179*v)/2312; select(p=0,0,0,0,&amp;G); v-=(
  57.                               W*F-T*(.63*m-I*.086+m*E*19-D*25-.11*u
  58.                                )/107e2)*_; D=cos(o); E=sin(o); } }

Great, really!

Some ways in which contributions are notable include:

1. The appearance of the source code, which may resemble images, text, etc.
2. Preprocessor redefinitions to make code harder to read
3. Self-modifying code
4. Worst abuse of the rules.

Some of the most popular categories are ::

Best Calculated Risk
Best abuse of the Periodic table
Best abuse of Indentation
Best Abuse of CPP

Obfuscated c home page :: Obfuscated c home

6 Responses to “The obfuscated Eiffel”

  • The obfuscated Eiffel - CodeCall Programming Forum 12June2008

    [...] _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_ _-_-_-_ } read the complete post :: Obfuscated c contest | TECHARRAZ __________________ God is real… unless declared an integermy blog :: [...]

  • Clipboard Game - Page 27 - CodeCall Programming Forum 12June2008

    [...] Clipboard Game [ Obfuscated c contest | TECHARRAZ ] __________________ God is real… unless declared an integermy blog :: [...]

  • complicated 14June2008

    [...] [...]

  • Pallab 14June2008

    Below is a 1988 entry which calculates pi by looking at its own area

    I could not make head or tail of that code. Totally went over my head.

  • admin 16June2008

    Well,that is the reason it is obfuscated! Even i did not unnderstand. Though the answer returned on some modifications is 0.2! I guess the modifications are wrong. It is supposed to work in some other compiler. I tries tc and gcc..

  • program coding 23June2008

    [...] C code held annually since 1984. The goal is thus to create the most complex and complicated logichttp://techarraz.com/2008/06/12/the-obfuscated-eiffel/Website Building Software: Create Websites without HTML coding …EZGenerator Website building [...]

Leave a Reply

 

RSS