International Obfuscated C Code Contest

International Obfuscated C Code Contest

The International Obfuscated C Code Contest (abbreviated IOCCC) was a programming contest for the most creatively obfuscated C code, held annually between 1984 and 1996, and thereafter in 1998, 2000, 2001, 2004, and 2006.[1] The winners of the 19th and final contest, held in 2006, were announced in November 2007; however, as of early 2011, the winning code has yet to be posted.[2]

Entries were submitted online, and would proceed through a number of rounds of being judged by a panel of judges. Entries were judged on how obfuscated their code was, and how creative they were. Entries that made it through the final round were awarded with a category, such as "Worst Abuse of the C preprocessor" or "Most Erratic Behavior", and were then announced on the official IOCCC website. Entries that did not make it were deleted and forgotten; the contest states that being announced on the IOCCC website is the award for winning.

Contents

History

The IOCCC was started by Landon Curt Noll and Larry Bassel in 1984 while employed at National Semiconductor's Genix porting group. The idea for the contest came after they compared notes with each other about some poorly-written code that they had to fix.[3]

Rules

Each year, the rules of the contest were published on the IOCCC website. Rules varied from year to year, and were posted with a set of guidelines that attempted to convey the spirit of the rules.

The rules were often deliberately written with subtle loopholes that contestants were somewhat encouraged to find and abuse. This was a result of the contest being a "parody of the software development process". Entries that took advantage of some loophole in the rules (whether or not they passed the final round of judging) would cause the rules for the following year's contest to be adjusted accordingly (although often other subtle loopholes were deliberately introduced in the process).

Obfuscations employed

Due to the nature of the contest, entries often employed strange or unusual tricks, such as using the C preprocessor to do things it was not designed to do, or avoiding commonly-used constructs in the C programming language in favor of much more obscure ways of achieving the same thing. For example, 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".[4]

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.[5]

Why not use the program to hide another program in the program? It must have seemed reasonable at the time.[6]

The program implements an 11-bit ALU in the C preprocessor.[7]

I found that calculating prime numbers up to 1024 makes the program include itself over 6.8 million times.[7]

Some ways in which contributions are notable include:

  • The appearance of the source code, formatted to resemble images, text, etc., after the manner of ASCII art.
  • Preprocessor redefinitions to make code harder to read.
  • Self-modifying code.
  • Worst abuse of the rules. In several years, an entry was submitted that was so patently absurd that it required a new definition of some of the rules for the next year.  This is regarded as a high honor. An example is the world's shortest self-reproducing program. The entry was a program zero bytes in length that if run printed zero bytes to the screen (simply an empty file).[8]

In the effort to take obfuscation to its extremes, contestants have produced programs which skirt around the edges of C standards, or result in constructs which trigger rarely used code path combinations in compilers. As a result, several of the past entries may not compile directly in a modern compiler, and some may even cause crashes.

Examples

Within the code size limit of only a few kilobytes, contestants have managed to do impressively complicated things — a 2004 winner turned out an operating system.[9]

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

#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_
            _-_-_-_
}

(Note that the entry was written in K&R C; it doesn't work correctly in ANSI C without some change.[11])

Another good example is the following cleverly-written flight simulator, the winner of the IOCCC in 1998[12] as shown below:

#include                                     <math.h>
#include                                   <sys/time.h>
#include                                   <X11/Xlib.h>
#include                                  <X11/keysym.h>
                                          double L ,o ,P
                                         ,_=dt,T,Z,D=1,d,
                                         s[999],E,h= 8,I,
                                         J,K,w[999],M,m,O
                                        ,n[999],j=33e-3,i=
                                        1E3,r,t, u,v ,W,S=
                                        74.5,l=221,X=7.26,
                                        a,B,A=32.2,c, F,H;
                                        int N,q, C, y,p,U;
                                       Window z; char f[52]
                                    ; GC k; main(){ Display*e=
 XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0))
; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400,
0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6}
; 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=
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
*T*B,E*d/K *B+v+B/K*F*D)*_; p<y; ){ T=p[s]+i; E=c-p[w]; D=n[p]-L; K=D*m-B*T-H*E; if(p [n]+w[ p]+p[s
]== 0|K <fabs(W=T*r-I*E +D*P) |fabs(D=t *D+Z *T-a *E)> K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K
 *D; N-1E4&& 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;
  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){
                                   XEvent z; XNextEvent(e ,&z);
                                       ++*((N=XLookupKeysym
                                         (&z.xkey,0))-IT?
                                         N-LT? UP-N?& E:&
                                         J:& u: &h); --*(
                                         DN -N? N-DT ?N==
                                         RT?&u: & W:&h:&J
                                          ); } m=15*F/l;
                                          c+=(I=M/ l,l*H
                                          +I*M+a*X)*_; H
                                          =A*r+v*X-F*l+(
                                          E=.1+X*4.9/l,t
                                          =T*m/32-I*T/24
                                           )/S; K=F*M+(
                                           h* 1e4/l-(T+
                                           E*5*T*E)/3e2
                                           )/S-X*d-B*A;
                                           a=2.63 /l*d;
                                           X+=( d*l-T/S
                                            *(.19*E +a
                                            *.64+J/1e3
                                            )-M* v +A*
                                            Z)*_; l +=
                                            K *_; W=d;
                                            sprintf(f,
                                            "%5d  %3d"
                                            "%7d",p =l
                                           /1.7,(C=9E3+
                              O*57.3)%0550,(int)i); d+=T*(.45-14/l*
                             X-a*130-J* .14)*_/125e2+F*_*v; P=(T*(47
                             *I-m* 52+E*94 *D-t*.38+u*.21*E) /1e2+W*
                             179*v)/2312; select(p=0,0,0,0,&G); v-=(
                              W*F-T*(.63*m-I*.086+m*E*19-D*25-.11*u
                               )/107e2)*_; D=cos(o); E=sin(o); } }

This program needs following command line on a Linux system to be compiled:

cc banks.c -o banks -DIT=XK_Page_Up -DDT=XK_Page_Down \
        -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
        -DCS=XK_Return -Ddt=0.02 -lm -lX11 -L/usr/X11R6/lib

See also

Notes and references

  1. ^ "Previous IOCCC Winners" (plain text). IOCCC. 2004. http://www0.us.ioccc.org/years.html. Retrieved 2010-04-03. 
  2. ^ "Who won the 19th IOCCC" (plain text). IOCCC. 2007. http://www0.us.ioccc.org/whowon2006.html. Retrieved 2010-04-03. 
  3. ^ [1]
  4. ^ IOCCC 2004 - Best Calculated Risk
  5. ^ IOCCC 2004 - Best abuse of the Periodic table
  6. ^ IOCCC 2004 - Best abuse of Indentation
  7. ^ a b IOCCC 2004 - Best Abuse of CPP
  8. ^ "smr.hint" (plain text). IOCCC. 1994. http://www.ioccc.org/1994/smr.hint. Retrieved 2006-09-16. 
  9. ^ "gavin.hint" (plain text). IOCCC. 2004. http://www.ioccc.org/2004/gavin.hint. Retrieved 2007-03-13. 
  10. ^ 5th International Obfuscated C Code Contest, 1988 - westley.c
  11. ^ using gcc, compile with the following command line: gcc -traditional-cpp -o r r.c or gcc -E r.c | sed 's/- -/--/g' > r2.c ; gcc -o r2 r2.c (The source file is r.c)
  12. ^ IOCCC Flight Simulator

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • International Obfuscated C Code Contest — Der International Obfuscated C Code Contest (kurz IOCCC) ist ein Programmierwettbewerb für die am kreativsten verschleierten C Programme, der seit 1984 jährlich veranstaltet wird (mit Ausnahme von 1997, 1999, 2002 und 2003). (engl.: to obfuscate …   Deutsch Wikipedia

  • International Obfuscated C Code Contest — IOCCC (от англ. International Obfuscated C Code Contest  «Международный Конкурс непонятного кода на Си»[1])  конкурс программирования, в котором задачей участников является написание максимально запутанного кода на языке Си.… …   Википедия

  • International Obfuscated C Code Contest — Le International Obfuscated C Code Contest (en français : « Concours international de code C obscur ») est un concours de programmation organisé chaque année depuis 1984 (à l exception de 1997, 1999, 2002 et 2003). Il y a plusieurs …   Wikipédia en Français

  • Obfuscated C Code Contest — ● ►en loc. m. ►LANGC En réalité, c est le IOCCC: International Obfuscated C Code Contest . Concours annuel qui se tient sur l Usenet depuis 1984. Le gagnant est celui qui produit le programme en C le plus illisible, créatif, et bizarre mais… …   Dictionnaire d'informatique francophone

  • Obfuscated code — Obfuscated code is source or machine code that has been made difficult to understand for humans. Programmers may deliberately obfuscate code to conceal its purpose (security through obscurity) or its logic to prevent… …   Wikipedia

  • Code Impénétrable — Le code impénétrable d un programme informatique est un code dont la compréhension est très difficile pour un humain tout en restant parfaitement compilable par un ordinateur. Appelé aussi assombrissement ou obfuscation, cette technique de… …   Wikipédia en Français

  • Code impenetrable — Code impénétrable Le code impénétrable d un programme informatique est un code dont la compréhension est très difficile pour un humain tout en restant parfaitement compilable par un ordinateur. Appelé aussi assombrissement ou obfuscation, cette… …   Wikipédia en Français

  • Code impénetrable — Code impénétrable Le code impénétrable d un programme informatique est un code dont la compréhension est très difficile pour un humain tout en restant parfaitement compilable par un ordinateur. Appelé aussi assombrissement ou obfuscation, cette… …   Wikipédia en Français

  • Obfuscated Perl Contest — The Obfuscated Perl Contest was a competition for programmers of Perl which was held annually between 1996 and 2000. Entrants to the competition aimed to write devious, inhuman, disgusting, amusing, amazing, and bizarre Perl code .[1] It was run… …   Wikipedia

  • Code impénétrable — Le code impénétrable d un programme informatique est un code dont la compréhension est très difficile pour un humain tout en restant parfaitement compilable par un ordinateur. Le procédé par lequel du code est rendu impénétrable est appelé… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”