Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming

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."
This discussion has been archived. No new comments can be posted.

20th IOCCC Source Code Released

Comments Filter:
  • Winners link (Score:5, Informative)

    by SimonCooper ( 638013 ) <ea_slashdot@sfik.com> on Monday April 23, 2012 @02:44PM (#39774987) Homepage
    The link to the winners and descriptions is, http://www.ioccc.org/2011/whowon.html [ioccc.org]
  • by McGregorMortis ( 536146 ) on Monday April 23, 2012 @02:59PM (#39775105)

    Your age is showing...

    Yes, kids, PCs used to have turbo buttons.

    • Re:Turbo button? (Score:4, Informative)

      by ericloewe ( 2129490 ) on Monday April 23, 2012 @03:03PM (#39775155)

      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?

      • Your guess is as good as mine; I've never seen a turbo button that was wired up to anything!
        (Pipe down, grandad. I'm not on your lawn.)
        • by gl4ss ( 559668 )

          it was pretty handy for che.. creative playing. you know, like in star control 2 doing the lander resource gatherings.

      • by Anonymous Coward

        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

        • 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.

        • 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.

          • by celle ( 906675 )

            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.

      • by Anonymous Coward

        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".

        • by tlhIngan ( 30335 )

          The best thing about the machine was the /proc/cpuinfo reported "CyrixInstead" rather than "IntelInside".

          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:Turbo button? (Score:4, Interesting)

        by ChatHuant ( 801522 ) on Monday April 23, 2012 @04:17PM (#39776025)

        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.

        • ... and there still were utilities (I remember 'goslow' and 'slow') you could use to slow down the PC even more if the turbo button was not enough. On my PC depressing turbo slowed it from 20 MHz to 10 MHz, but if you wanted to play old XT (4.77 MHz) games ('sopwith', anyone?), you could run these.

          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'.
      • by Nimey ( 114278 )

        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)

    by Anonymous Coward

    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 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.

    • Notepad was never intended to be a source code editor. To really mess things up, use Wordpad instead.
    • by gl4ss ( 559668 )

      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?

    • Same with my Firefox. Would like to just tell it that it's plain text somehow.

      • by Hatta ( 162192 )

        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)

    by Darinbob ( 1142669 ) on Monday April 23, 2012 @03:53PM (#39775745)

    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.

    • That one works with K&R C. It won't work with C90 or later.
      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.
      • 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.

        • by truedfx ( 802492 )
          Adding -D command-line options is cheating, as it allows a single-character program to do literally anything: gcc -Dx='main() { puts("Hello, world!"); }' x.c where x.c consists of a single line containing the character x.
          • by CODiNE ( 27417 )

            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...

          • True. The original should have done "#ifdef" but that would have unobfuscated it.

        • What command line options do you need? It's not working for me, even if I specify --std=c89.

          • 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.

        • Since Mac OS is based on a variant of Unix, unix is probably defined as "1". Same for compiling it under Linux. This is less likely to be true under Windows (either "0" or undefined).
          • 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.

      • You need to use an Ofuscated-C compiler. I would settle for Avenger Assembler though.

    • by don.g ( 6394 )

      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).

    • by Bomazi ( 1875554 )

      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.

      • 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).

The unfacts, did we have them, are too imprecisely few to warrant our certitude.

Working...