display | more...

The International Obfuscated C Code Contest, often called the IOCCC, is an (almost) annual contest to cram as much C code into an arbitrary size limit yet still having an interesting program. Some people have fun decyphering the code, while others think it's a pointless waste of time. Yet others wish the other two would stop arguing about it.

The IOCCC has a bad reputation of hosting "Bad C code" - it even says so on the website. In fact, it is quite the opposite; it is easy to write a quick C program, change all the variable names to one-character long names, remove all the whitespace, and call it obfuscated - and that is why 100% of the IOCCC winners do more than this.

As an example, try 2000/dhyang.c (code/hint). This is not just a quine; it prints a program, that prints another program, that prints another program, and so on... in a mutually-reproducing cycle. Not to mention that the code is in the layout of Saitou Hajime...

Another example: 1994/schnitzi.c (code/hint). When you compile and run, it converts a file from this:

abc
def
ghi
To this:
adg
beh
cfi
That is, it flips a file along the top-left-bottom-right diagonal. If you try to run the program on its own code, you get a new program that compiles to do the same thing, along with revealing a secret message and having completely different bits of code than the original.

The Jargon File entry above me shows possibly the most famous entry, 1988/westley.c (code/hint) - it calculates π from working out its own area. Even though it's not as obfuscated as the other entries, it's pretty darn clever.

The rules are meant to be as loose as possible - if a hole is found, the judges will plug the hole "with as small a plug as possible, if not smaller". Although breaking the size limit or abusing the submission process just annoys the judges, active rule-bending is encouraged, and most years there is a "Best/worst abuse of the rules" award for the entry that does so.

Other entries include a completely blank entry ("the world's smallest quine!"), a complete x86 operating system, a PET emulator, and three different programming languages in the same file - all in a few kilobytes of source.

Despite this, there are still people that exclaim "But these entries are crap! You can't read the source code - it's illegible! This person obviously doesn't know anything about C." These people could not be further from the truth. Although it's easy to produce illegible code, it takes mastery of a language to produce obfuscated code of the level shown here.


The 2005 winners have been announced on November 6th: http://www.ioccc.org/whowon2005.html