Tag: IOCCC29

  • Pong game recompiles its own source code every frame — winning entry at IOCCC29 was generated by a custom compiler

    The Art of Cursed Code: How One Programmer Won a Prize for Self-Modifying Pong

    In the bizarre and brilliant world of competitive programming, some achievements move beyond mere logic and enter the realm of performance art. Jonah Uellenberg recently claimed the Ping Pong Prize at the 29th International Obfuscated C Code Contest (IOCCC), not by writing a typical program, but by creating an experience that literally compiled itself into existence—a masterpiece of self-modifying code.

    The game at the heart of this victory was a version of Pong that fundamentally rewrote its own source code with every single frame. This isn’t simple trickery; it’s a sophisticated application of programming concepts taken to an absurd, yet masterful, extreme. Every run of the program prints the C source for the next state, embedding the current game display and status directly within it. Running this output executes the compilation process, advancing the game by one frame at a time.

    Uellenberg’s genius lies in the methodology behind the obfuscation. He didn’t just scramble the code; he leveraged the compiler itself. His entry notes reveal that the winning code is not truly obfuscated but rather the result of extreme optimization. He utilized his custom-built language, Insert, which compiled down to C, running all the rigorous size-optimization passes that a professional production compiler employs—such as liveness analysis, constant folding, and variable-merging techniques.

    The irony is delicious: Uellenberg found that optimization and obfuscation often collapse into the same output. By packing repeated token sequences into C preprocessor defines, he managed to shave off crucial bytes, resulting in a dense, seemingly chaotic wall of single-character identifiers and data arrays. It’s a testament to the idea that maximum efficiency can be indistinguishable from maximum obscurity.

    This concept is rooted in the quine—a program that prints its own source code when executed. Uellenberg’s version takes this familiar trope and turns it into dynamic gameplay. The player controls the right paddle by entering simple commands like “w” or “e,” competing against a computer opponent. A further layer of wildness is introduced when winning the game switches the program to an entirely different experience: a side-scrolling jumper modeled after the Chrome dinosaur runner, before seamlessly transitioning back to Pong.

    The effort required for this achievement places Uellenberg among a select group of programmers pushing the boundaries of what code can achieve. This prize sits alongside other remarkable feats achieved in the field, including an x86 CPU emulator written entirely in CSS and a playable build of the game Doom rendered in pure SQL.

    The IOCCC29 contest, which saw this victory, was part of a continuing tradition of extreme coding challenges. The event marks the second contest since organizers paused running the competition for four years, showcasing a community dedicated to wringing full systems out of unlikely materials and proving that code can be anything from functional software to pure performance art.