Obfuscated C 8080 Emulator Ported

[Oscar] is no stranger to writing hard-to-read C code. While most of us do that by accident, there are those who strive to write the most unreadable code and enter it in the IOCCC — the International Obfuscated C Code Contest. One of his winning entries was a single C function that emulates an 8080. With a few support files, the plucky little emulator will run CP/M.

The emulator won best in show, but that was in 2006. Things have changed a bit and [Oscar] has updated the code so that you can continue to try it if you want to give yourself a headache reading code. The portability isn’t a CPU issue — modern CPUs will happily run code from 2006. The problem is the compiler and operating system. Compilers are much stricter these days, and Linux needs a little extra coaxing to give access to the input stream the way the faux computer needs it.

Continue reading “Obfuscated C 8080 Emulator Ported”

Mmm… Obfuscated Shell Donuts

In case you grow tired of clear-written, understandable code, obfuscation contests provide a nice change of scenery, and trying to make sense of their entries can be a fun-time activity and an interesting alternative to the usual brainteasers. If we ever happen to see a Simpsons episode on the subject, [Andy Sloane] has the obvious candidate for a [Hackerman Homer] entry: a rotating ASCII art donut, formatted as donut-shaped C code.

The code itself actually dates back to 2006, but has recently resurfaced on Reddit after [Lex Fridman] posted a video about it on YouTube, so we figured we take that chance to give some further attention to this nifty piece of art. [Andy]’s blog article goes in all the details of the rotation math, and how he simply uses ASCII characters with different pixel amounts to emulate the illumination. For those who prefer C over mathematical notation, we added a reformatted version after the break.

Sure, the code’s donut shape is mainly owed to the added filler comments, but let’s face it, the donut shape is just a neat little addition, and the code wouldn’t be any less impressive squeezed all in one line — or multiple lines of appropriate lengths. However, for the actual 2006 IOCCC, [Andy] took it a serious step further with his entry, and you should definitely give that one a try. For some more obfuscated shell animations, check out the fluid dynamics simulator from a few years back, and for a more recent entry, have a look at the printf Tic Tac Toe we covered last month.

Continue reading “Mmm… Obfuscated Shell Donuts”

Tic-Tac-Toe Implemented In Single Call To Printf()

[Nicholas Carlini] programmed a C implementation of two-player Tic Tac Toe, and he did it in a single call to printf(). The arguments for that single function call get mind-bendingly complex, so it may come as no surprise that it was written for The International Obfuscated C Code Contest (IOCCC).

Most of us are aware that printf() is one of those functions that is considerably more complex under the hood, and capable of far more, than it may appear to be. But did you know that it is capable of Turing-complete computation?

[Nicholas] clearly steps through the theory, so give it a read. In short, a maze of arguments handles the logic of the game while an embedded scanf() reads user input, and printing the game board is always preceded by an escape code to clear the screen.

[Nicholas] is certainly no stranger to in-depth understandings; we’ve seen his work before in demonstrating how to fool speech recognition with hidden commands, including a powerful example showing how two virtually identical-sounding audio files transcribe entirely differently.

Animated ASCII Fluid Dynamics Simulator Is Retro Cool

ASCII art holds a place near and dear to our hearts. If you were fortunate enough to get started in computers before there was such a thing as a graphical user interface (GUI) then you remember tolling for hours to make clever use of the ASCII characters to make on screen graphics appear as realistic as possible.

Although this animated ASCII fluid dynamics simulator dates back to 2012, it’s just too cool not to share. It’s the product of the International Obfuscated C Code Contest (IOCCC). A contest held each year where the goal is to write the most confusing C code that you can – making use of loopholes and ambiguity in the C programming language to obfuscate(hide) the purpose of the program. Basically, doing everything you’re taught not to do in school. You can take a look at the source code here.

We’re sure the programmer [Yusuke Endoh] would be the first to admit, that there is no practical use for such a low resolution simulator, but we give it an A+ in the retro cool department anyways. (Not to mention, the source code is way too confusing to even comment on) Take a look at the animated ASCII graphics in the video after the break.

Continue reading “Animated ASCII Fluid Dynamics Simulator Is Retro Cool”

International Obfuscated C Code Contest Winners Posted

ioccc

The International Obfuscated C Contest – the contest to create the most useful, useless, or unique program in absolutely unreadable C code – has just posted the winners of the 2013 contest.

Of the entries of note, a few really stand out. The pic at the top of this post, for instance, comes courtesy of this submission. It’s an iterative ray tracer stuck inside an infinite loop that, when left running overnight, is able to produce amazing renders.

An IOCCC contest wouldn’t be complete without some ASCII art C code, and this entry fits the bill. It’s a Tetris painting tool that creates images made out of tetronomoes. Each image is built up one line at a time from the bottom up, using Tetris’ lack of physics to create a picture out of un-cleared lines.

One of the most impressive entries for this (last?) year’s contest is a tiny 8086 PC emulator/virtual machine written in only 4043 bytes of code. It’s a fully functional 80s-era PC emulator that can run vintage copies of AutoCAD, Windows, Lotus 1-2-3, and SimCity.

All the submissions are awesome, but like any IOCCC contest, there aren’t actually any winners. Or they’re all winners. The Obfuscated rules aren’t very clear in that regard.

The International Obfuscated C Code Contest Is Back

The International Obfuscated C Code Contest is back. The stated goals of the IOCCC are to, “Write the most obscure C program, show the importance of programming style (by doing the opposite), stress the preprocessor to the breaking point, and illustrate some subtleties of the C language.” If you think you’re up to the task of abusing your compiler, check out the rules and guidelines for the contest.

There’s nothing quite like having the code for a flight simulator look like a plane, or calculating pi by measuring the area of C code. The submissions to the IOCCC are classic hacks; very clever things that shouldn’t work, but do despite themselves.

There hasn’t been an IOCCC competition since 2006, and no one knows if it will be around next year. We’ve already seen a few potential entries for this year, like piping chars into /dev/audio to generate a song and hyperlinks all the way down. If you’ve got something you’re working on, feel free to send it in.

via /.