20th IOCCC Source Code Released 46
An anonymous reader writes "The 20th International Obfuscated C Code Contest apparently has the turbo button pressed, as the source code has been published in only two months, versus almost four years of the 19th contest. As we discussed in February, the judges' verdicts are in: the Best of Show entry comes from Don Yang with a program containing more programs. Some other entries winning this year are a text raytracer (used this year in IOCCC logo), a MOD player, a X11-based dual player tank shooter and a bouncing ball (Amiga-style) with ANSI escape sequences. Remember that every IOCCC entry has a limit of 4 kilobytes, so indeed every one is pretty impresive."
Winners link (Score:5, Informative)
Re:Poop (Score:5, Funny)
I eat poop.
This is about C coding.
Relating your experience coding Java is irrelevant.
Turbo button? (Score:4, Funny)
Your age is showing...
Yes, kids, PCs used to have turbo buttons.
Re:Turbo button? (Score:4, Informative)
Weren't they actually underclock switches to maintain compatibility with older software that relied on the processor's clock for timing, the "turbo" being a marketing gimmick to make it sound faster?
Re: (Score:2)
(Pipe down, grandad. I'm not on your lawn.)
Re: (Score:3)
it was pretty handy for che.. creative playing. you know, like in star control 2 doing the lander resource gatherings.
Re: (Score:1)
Yes. The "turbo" button, when on, would run the processor at full speed or allow caching. The Wikipedia article [wikipedia.org] mentions that exceptions exist, but did not mention any. I think the reason is that people would start some programs and go "Whoa! This is running too fast," and then hit the turbo button to try and get it to run normally. None of my computers had one, but I don't know if I would actually run a computer like that.
Interestingly, one of my uncles had a computer that had one and always had it se
Re: (Score:2)
The only one I had switched from 50MHz to 80MHz. No logical reason to run it slower for most anything.
The only game I saw that really had problems was Wizardry 6 (I think) where the animations would run in hyper speed.
Re: (Score:2)
My family's first computer was a 25mhz 486sx.
Running North & South at 25 made it exceedingly hard to do anything at all due to the speed of everything.
Turning off the 'turbo' button slowed it down to 10mhz and made it playable.
Re: (Score:2)
I had a 50Mhz DX back then(early ninties), with turbo off down to 25Mhz. Made "blip to death" in fighter mode on Wing Commander down to "warp speed to death" with the turbo off. Another great game bit the dust as I had sold my earlier rig to pay for the DX. I still have my copy of WC in my basement somewhere too.
Re: (Score:1)
The turbo button on my Cyrix-based machine disabled a cache.
The best thing about the machine was the /proc/cpuinfo reported "CyrixInstead" rather than "IntelInside".
Re: (Score:2)
Actually, it's 12 characters long - 3 registers.
Intels report "GenuineIntel"
AMDs report "AuthenticAMD"
Vias say "CentaurHauls"
I don't remember what the other x86-clones report.
Re: (Score:3)
Re: (Score:2)
i had the same thing.. except it was different values and was wired to the jumpers for the bus speed.. so flipping it would overclock the bus and there for the CPU and did make things go faster.. it was not a wise idea to flip it while running.. but it did work.. I used it to overclock a dual P-Pro setup from 180-233(225).
Re:Turbo button? (Score:4, Interesting)
Weren't they actually underclock switches to maintain compatibility with older software that relied on the processor's clock for timing,
Yup, that's what they were. The original PC had a hardware timer (an 8253 IIRC), but all available counters were used for timekeeping interrupts, sound generation and the like. Many programs (especially games) used software loops to generate timing, assuming the clock ran at the original IBM PC's 4.77 MHz. When the 80286-based /AT was introduced, those programs become unusable. To preserve some compatibility, manufacturers introduced the "turbo" button, whose purpose was actually to slow down the machine close to the original PC speed. This button remained a feature on cases for years, even though it often wasn't even connected to anything anymore.
Re: (Score:1)
My CS teacher used to turn turbo off by default 'so that all those outputs would not flash in front of her eyes so blazingly fast'.
Re: (Score:2)
Yep. The only machine I ever had with a turbo button read its state at boot time and then ignored it if you pressed it again before rebooting. This machine (a Pentium 90) has a mini Linux distribution on it, so booting the thing with it enabled is... boring.
I believe the goal of most turbo buttons was to approximate the speed of an 8 MHz 80286. I don't know why this was chosen instead of a 4.77 MHz 8088; maybe it was easier to simulate the speed of something faster.
UCC is better (Score:2, Interesting)
I always thought that the Underhanded C Contest was better. Rather than making the code hard to read or doing the odd layout, I think it is better to show people that malicious things can be hidden in even the most readable code. People always worry about malice hidden in the long unreadable stuff, but can you find the problem in this? [notanumber.net]
the true obfuscation (Score:1)
The true obfuscation is that Chrome will not display .c files, but forces you to save it.
Then, if you open it in Notepad, it will show it all as one line, so you can't see whats going on.
Pure genius.
Re: (Score:3)
Re: (Score:2)
The true obfuscation is that Chrome will not display .c files, but forces you to save it.
Then, if you open it in Notepad, it will show it all as one line, so you can't see whats going on.
Pure genius.
it's just their mimetypes. ie and firefox do the same thing. if you had opened the .c file in IE, it would show the source as intended. silly, huh?
Re: (Score:2)
Same with my Firefox. Would like to just tell it that it's plain text somehow.
Re: (Score:2)
There's an add-on for that. I'm running "Open In Browser 1.11" on Firefox 10.0.3. Works great.
Favorite (Score:5, Interesting)
My favorite is still from 1987 by David Korn. Short, sweet, not arranged in a silly picture, not obscure due to lack of indenting or white space, and seems to exemplify the spirit of obfuscated C. Though it does have portability issues and intended for older compilers (try to figure out before compiling as compiler messages will give a huge hint).
main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}
I've always been tempted to give this as a question during interviews.
Re: (Score:1)
Can you tell why not?
I should also note that Daniel Ireland's explanation of why/how it works is incorrect.
Do you know what is wrong with the explanation?
How does it actually work?
That is still one of the best, because all the assumptions it relies upon were valid at the time it was written.
Re: (Score:2)
It does with with my GCC on Mac OS 10 and runs correctly, given the right command line option to the compiler. It even works with "--std=c99 --pedantic". Though it does give warnings.
There is a key concept in it though that a good C programmer should know, and that's probably the big thing that sets it apart from most other obfuscated C entries.
Re: (Score:2)
Re: (Score:2)
Thanks for the tip. Now to hide an nurses program source in a makefile and laugh while everyone is wondering how hello.c is doing all that stuff.
The prank potential of -D is unbounded... not to mention backdoor hiding...
Re: (Score:2)
True. The original should have done "#ifdef" but that would have unobfuscated it.
Re: (Score:2)
What command line options do you need? It's not working for me, even if I specify --std=c89.
Re: (Score:2)
It compiled on linux with GCC 3.4.4 just now with zero warnings or errors and with no extra command line options needed. But it fails there if using "--std=c89" unless I add a "-Dsomething" to command line, because using "--std" will remove most predefined preprocessor symbols. From the error messages you should be able to tell what's missing. Later GCC versions also remove the predefined symbol that's needed as well, and may also complain about "printf" not being defined.
Re: (Score:1)
Re: (Score:2)
Actually it isn't defined under Mac OS either. That's why I mentioned it wasn't portable, and that one should attempt to figure it out before trying to compile because compiler errors will give a huge hint.
Ofuscated-C Compiler (Score:2)
You need to use an Ofuscated-C compiler. I would settle for Avenger Assembler though.
Re: (Score:3)
The only thing that threw me is that "unix" symbol. cpp says it's "1" -- I assume it's one of those #defines to let you know what platform you're on.
*** SPOILER ALERT ***
After that it's easy -- obvious principle at work is that a[b] is equivalent to *(a+b).
Re: (Score:1)
I don't like this because it depends on knowing an obscure trivia (i.e. that unix == 1) that is not in ISO C and totally useless. An interviewee shouldn't fail because of that.
Re: (Score:3)
You don't pass/fail interviewees on this. But the interviewee should at least ask "what is the value of this variable, I don't see it defined?". Then the task is whether they realize that a[const] is same as const[a], or can ask an intelligent question about that. I've never actually done stuff like this on interviews. As time goes on I keep simplifying my questions because so many only know C or C++ superficially (even if it's on their resume).
Re: (Score:1)