A Tradition Continues: the International Obfuscated C Code Contest

Very few pieces of geek culture have lasted for 34 years. But back in 1984, two overworked programmers established a long-standing tradition that seems to have sprung up organically from their own common travails. It gradually snowballed into a community, a legend, and an accidentally-educational endeavor that’s always both unpredictable and wildly entertaining.

But on the contest’s website, you can always peruse the code from the last contest (held in 2015, but with the winning source code revealed six months later) — and indeed, every prize-winning piece of obfuscated C code from the previous years’ contests. So there’s always a lot to see.

Although you’ll probably going to have a hard time understanding it…

Great Obfuscations

The contest lists among its goals “to show the importance of programming style, in an ironic way.” Its other goals? To demonstrate the language’s subtleties, to write obfuscated code, to stress poor unsuspecting C compilers, and “to provide a safe forum for poor C code.”

But while the entries may be hard to understand, they’re not always hard to read. One 1990 entry won a “best layout” award by stitching bits of C syntax like char* and for into a simulated correspondence between a would-be suitor named (char*)(lie= and the object of his affection, (*((char*)&lotte)^=. The code, when executed, printed an excerpt from their conversation selected by your command-line parameters.

Back in 1994 MIT student Szymon Rusinkiewicz even submitted a legendary program which won that year’s highly coveted “Worst abuse of the rules” award. More than two decades later, the judges still refer people to it in their official FAQ. They warn people who try to submit an impressively small program whose output is the program’s own source code, “do not claim your program is the smallest one without seeing it.” Rusinkiewicz had simply submitted a blank file — which C compilers would still process — generating, of course, “a program that does nothing.” And best of all, the output from this program…thus has the distinction of re-creating all of its original source code.

Over the decades this convoluted contest has built up more bits of lore and legend, and it reportedly even came up in a computer trivia quiz emceed by Bill Gates back in 1993. The then-CEO of Microsoft asked:

“Since 1984, a contest has been held on Usenet for the most unreadable, creative, bizarre but working C program. What is the name of this contest?”

“Windows!” someone responded.

But even more amazingly, someone worked this episode into their entry in the International Obfuscated C Contest that same year. Chris Mills quoted a newspaper account about the event in the “hint” file for his entry, before contributing a program that “makes your windows about as useful as their windows.”

Make Files

So how did all this madness get started? Back in 1984 two employees at National Semiconductor were both trying to fix “some very broken code,” according to the contest’s official FAQ — and happened to wander into the hall at the same time. The two programmers — 24-year-old Landon Curt Noll and a man named Larry Bassel — had their moment of inspiration, and you can still read the Usenet post that started it all in a discussion group about the C programming language.

“im sure you have all seen gross, or down right structurally obscene C source code before. some people who deal with various parts of the UN*X source wonder if some folks try rather hard to produce such down right smelly code. now you have the chance to compete with the worst C hackers around by sending in your own obfuscated C program…

“entries will be judged for: violations of structured programming, non-clarity, and use of ‘by the K&R book’ C.”

The first rule specified that source files could be no larger than 512 bytes, and since the post promised it was the “1st annual” contest, the two programmers felt obligated to hold a second one in 1985. And the rest is history.

“When we began to receive messages from outside of the U.S.,” Noll remembers, “Larry and I decided to include International in the name.” And now the official IOCCC website explains that to this day, “The tradition continues as the longest-running contest on the Internet.”

One of the contests first winners was Larry Wall, who followed his back-to-back victories in 1986 and 1987 by writing his own programming language, Perl. (The prizes he had won were “most rounded in confusion” and “most useful obfuscation.”)

The contest also inspired one coder to create the Obfuscated Tiny C Compiler back in 2002. And 16 years later he’s back in competition, winning this year’s “Most Inflationary” award.

And 34 years later, Noll — now 57 years old — is still one of the contest’s judges.

Code of Today

In 2007 the contest’s winners were announced at a Vintage Computer Festival at the Computer History Museum in Silicon Valley. But this year the winners apparently got their notification on Reddit and Twitter.

For the obfuscated C contest, the number of entries are never revealed — “by tradition,” explains the FAQ. But this year there were 13 different winners. And the contest was truly international, with winners coming from seven different countries. Interestingly, two people won two awards this year — Yusuke Endoh from Japan and Dave Burton from the U.S. (This appears to be the fourth year that Endoh has won something — and in fact, in each of those years he’s won at least two awards, including the 2013 award for “most tweetable 1-liner.”)

Five other Americans also won awards, and there were also winning entries from Australia, China, Poland, Sweden, Finland, and France.

The “Most Unstable” prize was awarded to an Australian named… “Anonymous Author” (Who wouldn’t want their real name associated with prize-winning instability?) But it’s important to remember that each year the judges come up with the categories only after reviewing the submissions.

Other prizes awarded this year include “Best use of weasel words” and “Most shifty”…

But lurking over the contest is the specter of bad code in the real world. An official overview of the contest (written in 1999) specifically credits the code for the finger command in the source for the Bourne shell for part of the contest’s inspiration. “If this is what could result from what some people claim is reasonable programming practice, then to what depths might quality sink if people really tried to write poor code?”

Congrats all! I knew I could do it but had to compete against many extremely clever obfuscators; the fact this is the first time I had the full contest duration to do my entry (last time was <1week) makes me enormously proud and it's my best accomplishment by far. Good job all! https://t.co/Osx6pJy2G5

But it also seems to suggest that the contest may have ultimately performed a public service. “Thru the contest I have tried to instill two things in people,” Noll has written. “First is a disgust for poor coding style. Second was the notion of just how much utility is lost when a program is written in an unstructured fashion.” And to drive home the point, he cites the definition of satire.

“Keen or energetic activity of the mind used for the purpose of exposing and discrediting vice or folly.”

Pulling Back the Curtain

Behind the contest, there’s obviously a lot of brainpower. Besides Noll himself, this year’s judges also include Simon Cooper, who has the rare distinction of co-authoring one of O’Reilly publishing’s technical books. (Building Internet Firewalls: Internet and Web Security) And Russian programmer Leonid A. Broukhis preserves the international flavor of the contest — and is also a two-winner of previous contests. In 1993 he won a “best game” prize for a strangely-indented program that played the color-guessing game “Mastermind”. And he also won a “best use of obfuscation” award in 1995 for a program that seems to create a screensaver out of chemical diagrams.

The judges are the contests real unsung heroes, since the FAQ explains that it takes a “fair amount of time” to go through all the entries — and everything else associated with the contest. “It takes a few weekends and a number nights of study and work… which is hard given that we are busy with many other activities as well.”

Noll also seems to be a secret educator. His personal web page re-publishes an encouraging response he sent to someone asking how to become a professional C programmer. After some practical tips — write programs for other people, publish your code online and support it — he adds that “It is somewhat easy to write a program that works. It requires practice and effort to write code that you can maintain and support. The programs that win the IOCCC are NOT good programs. While they work, and some work very well, they cannot be maintained or improved…

“Often they cannot be maintained or improved even by their original author.”

Further into the essay, Noll adds an almost wistful note. “Always, always, always write code as if it will last 30 years…