Slashdot Mirror


IOCCC Accepting New, 'Improved' Entries

Rudolf writes: "The 16th International Obfuscated C Code Contest is open from now until 01 Dec 2001 23:59:59 UTC. Details are at the IOCCC web site. From the front page, the contest goals are: -- To write the most Obscure/Obfuscated C program (within contest rules -- To show the importance of programming style, in an ironic way. -- To stress C compilers with unusual code. -- To illustrate some of the subtleties of the C language. -- To provide a safe forum for poor C code. :-)"

144 comments

  1. Compilers? by notext · · Score: 1

    To stress C compilers with unusual code

    Some compilers become stressed easier than others.

  2. too bad .... by Alien54 · · Score: 0, Troll
    we can't nominate windows for an obfuscated code category of some sort.

    but then, it is probably the all time champion of obfuscation, in any language.

    unless we look at something like OS/2?

    --
    "It is a greater offense to steal men's labor, than their clothes"
  3. Cute site by Matey-O · · Score: 2, Funny

    Anybody notice the 'A is for ASCII, B is for Byte' stuff on the winners index?

    link

    --
    "Draco dormiens nunquam titillandus."
    1. Re:Cute site by Anonymous Coward · · Score: 0

      No, because I got :
      A for awks
      B for bc
      C for cc
      ...

      Very cute site in fact !!

  4. russians will win? by weinford · · Score: 2, Interesting

    I once heard, it may be a rumour, but at least it's a nice story, that (once upon a time) russian coders liked to write code with obfuscation built in. They were so scared to loose their jobs that they wrote code only themselves could understand, using strange/misleading variable names, senseless loops or whatever. Can anyone confirm this? I think it's a nice technique ;-) Maybe the compiled code is even easier to understand...

    --

    This sig is stolen from someone who had a much better idea than I had.
    1. Re:russians will win? by Anonymous Coward · · Score: 3, Funny
      It would not be the first time I read the assembly generated by the compiler to understand what the damned C code meant.


      There are cases, often with complex logical expression with deeply nested parenthese, && and ||, where the assembly is easier to read than
      the so called "high level" source code.
      (Well, C is not high-level in any case)

    2. Re:russians will win? by Anonymous Coward · · Score: 2, Informative

      I once heard, it may be a rumour, but at least it's a nice story, that (once upon a time) russian coders liked to write code with obfuscation built in. They were so scared to loose their jobs that they wrote code only themselves could understand, using strange/misleading variable names, senseless loops or whatever. Can anyone confirm this?

      It's a well documented phenomena.

    3. Re:russians will win? by jgerman · · Score: 2

      Russian Coders? How about U.S. gorvernment coders?

      --
      I'm the big fish in the big pond bitch.
    4. Re:russians will win? by empesey · · Score: 2

      Russians? Americans used to do the same thing. Maybe not with the misleading variable names, but obfuscation was part of the game. It wasn't until the 80s that people started shifting focus towards software development toward a more professional focus. During the 60s mostly (and into the 70s) you had the core-wars hacker types discovering what was possible and trying to push the envelope.

    5. Re:russians will win? by Anonymous Coward · · Score: 2, Funny

      > it's a nice story, that (once upon a time) russian coders liked to write code with obfuscation built in.
      > Can anyone confirm this?

      I have one story that is true.

      When I worked on image recognition software (1999), the boss decided that we needed a new recognition engine. So he paid for some source code written by a Russian (the guy didn't speak English, with almost no net acess, and limited access to a phone.)

      It was the worst piece of inefficient spagitti (crap) code I have ever seen. Variables names like j1, j2, j3, j4, j20, j22, and hardcoded array access like x[4] = , x[50] =, x[52] =. It took me a few months of reverse engineering and cleaning it up. I ended up just chucking it away, and starting from scratch, which was a valuable lesson for me -- If you're spending most of your time refactoring existing code, it's better to just chuck it away and start fresh with a clean design.

      > Maybe the compiled code is even easier to understand...

      It was! I also found it usefull to treat each function as a black box, and figure out
      a) input (& are they const)
      b) outputs (& are they const)
      c) intermediate values

      Ironically we had a co-worker Russion coder that was half decent. A little inexperienced on good coding practises, but a hard worker, and I could depend on him to get tasks done.

      Obviously 2 people isn't a large statistical enough sample to draw any conclusions from.

  5. When will they start an obfuscated perl contest? by forgoil · · Score: 3, Funny

    Or would that be too easy?;)

  6. An entry by ackthpt · · Score: 0, Offtopic
    The could enter slashcode!


    Oh, wait, that's perl, isn't it?

    --

    A feeling of having made the same mistake before: Deja Foobar
  7. my fovorite by snatchitup · · Score: 4, Funny

    My favorite isn't so much obfuscated code, but hair-brained.. I've actually seen this by paid contract programmers......

    String getLetter( int index ){
    String [] x = { "A", "B", "C", "D" };
    for ( int i = 0; i < 4; i++ ){
    if ( i == 0 && index ==0 )
    return "A";
    else if ( i == 1 && index == 1 )
    return "B";
    else if ( i == 2 && index == 2 )
    return "C";
    else if ( i ==3 && index == 3 )
    return "D";

    if ( i >= 4 )
    break;
    }
    return null;
    }

    Are they getting paid by the line?

    1. Re:my fovorite by Xiver · · Score: 0, Offtopic

      int x[100];

      for(int iApple = 0; iApple = 0; --iApple){
      cout (int)(99 - iGrape[x]) endl;
      }

      --
      10: PRINT "Everything old is new again."
      20: GOTO 10
    2. Re:my fovorite by Xiver · · Score: 0, Offtopic

      int x[100];

      for(int iApple = 0; iApple < 100; ++iApple){
      iApple[x] = iApple;
      }

      for(int iGrape = 99; iGrape >= 0; --iGrape){
      cout << (int)(99 - iGrape[x]) << endl;
      }

      --
      10: PRINT "Everything old is new again."
      20: GOTO 10
    3. Re:my fovorite by cdraus · · Score: 1

      that's not even C... very nice

    4. Re:my fovorite by Xiver · · Score: 1

      Well if you want to get really picky.

      int x[100];

      for(int iApple = 0; iApple < 100; ++iApple){
      iApple[x] = iApple;
      }

      for(int iGrape = 99; iGrape >= 0; --iGrape){
      printf("%d\n", (int)(99 - iGrape[x]));
      }

      --
      10: PRINT "Everything old is new again."
      20: GOTO 10
    5. Re:my fovorite by n3m6 · · Score: 1, Flamebait

      there is no String s .. you half brained C++ trolls..

    6. Re:my fovorite by sir99 · · Score: 1

      There's no String in C++ either. It's std::string (lowercase). I'm guessing that String is #defined to char *

      --
      The ocean parts and the meteors come down
      Laid out in amber, baby.
    7. Re:my fovorite by Amazing+Quantum+Man · · Score: 1, Offtopic
      That's nothing... I once saw the following kn actual production code:


      /* look for the first non-blank */
      char *p;
      p = some_string;
      while (strncmp(p," ",1) == 0)
      p++;

      --
      Fascism starts when the efficiency of the government becomes more important than the rights of the people.
    8. Re:my fovorite by A+Big+Gnu+Thrush · · Score: 2

      It's Java.

    9. Re:my fovorite by maxpublic · · Score: 1

      When I was programming for large corporations as an independent contractor I would sometimes write code inefficiently like the example listed above.

      Why? Because many of the in-house 'programmers' weren't actually programmers; they were power users of particular apps programmed by others and critical to the operation of the company. No one else in the company was qualified to make the distinction, or technical enough to see that all the 'code' these guys wrote they downloaded from the internet and tweaked for their company's specs, while removing all copyright information.

      In other words, they didn't understand anything but the most basic of programming elements.

      When I was hired by these corporations I was usually handed off to the IS department and they would tell me what they'd want. I'd write a nice, elegant piece of code, turn it in, and they'd tell me to rewrite it because it was 'unnecessarily complicated'. Translation: they couldn't read it because they weren't capable of doing any real programming themselves. So I would often end up 'dumbing it down' until the IS people could follow along as I explained (in copious documentation) how everything worked.

      Sometimes it was incredibly embarrassing and I'd throw away the code rather than add it to my portfolio. The worst such moment came when I wrote a Perl app for one of North America's largest timber companies (which shall remain nameless) that I had to revise FIVE TIMES. The last iteration had no subroutines or function calls because *nobody in the IS department understood what a function or subroutine was*. So for the app I did everything with GOTO statements - because they understood GOTO.

      Yep. GOTO. Each and every jump in the code. GOTO. Quite challenging, actually, not being able to use subroutines or function calls. But it was so ugly, so heinous, and so...juvenile...I never told anyone about that job. I didn't want anyone to know that I'd written that incredible dog.

      Sometimes bad code is written by bad programmers. Sometimes bad code is written *for* bad programmers.

      Max

      --
      My god carries a hammer. Your god died nailed to a tree. Any questions?
  8. Is It Open to the Pros? by Lunastorm · · Score: 0, Offtopic

    I wonder if Bill Gates will enter.

    --
    You die too easily.
    1. Re:Is It Open to the Pros? by tb3 · · Score: 2

      I saw some of the source code to Microsoft's ODBC drivers, years ago. I gave up trying to figure out their SQL parser when they referenced -5 from the start of an array. Scary stuff.

      --

      www.lucernesys.comHorizon: Calendar-based personal finance

    2. Re:Is It Open to the Pros? by chongo · · Score: 1
      All entries must be in the public domain. We toss out anything that comes with a copyright. So unless Micrsoft started giving away ...

      p.s. Speaking of twisted array references I like Korn's: 1987 Best One Liner:

      main() { printf(&unix["\021%six\012\0"],(unix)["have"]+ "fun"-0x60);}

      Try to figure out what it does without compiling it first. Over the years I have not found very many people who could do it correctly the first time.

      It compiles with out any special flags:

      cc korn.c -o korn

      Hint: it does not work the same on a Microsoft based system. :-)

      --
      chongo (was here) /\oo/\
    3. Re:Is It Open to the Pros? by tb3 · · Score: 1

      I give, I'll just have to try compiling it. I suspect it's using my favorite C trick, "there's no such thing as arrays". Arrays are just pointer arthimetic. But those type conversions and casts(?) make my head spin.

      --

      www.lucernesys.comHorizon: Calendar-based personal finance

    4. Re:Is It Open to the Pros? by Anonymous Coward · · Score: 0
      I'm on a FreeBSD system using gcc and all I get is:

      crap.c: In function `main':
      crap.c:1: `unix' undeclared (first use in this function)
      crap.c:1: (Each undeclared identifier is reported only once
      crap.c:1: for each function it appears in.)

      What the hell?

    5. Re:Is It Open to the Pros? by wabb1t · · Score: 1

      Are you sure? Here is what I get:

      host% uname -v
      FreeBSD 4.4-RELEASE #0: Fri Sep 21 17:54:34 EEST 2001 root@host:/usr/src/sys/compile/HOST
      host% echo 'main() { printf(&unix["\021%six\012\0"],(unix)["have"]+ "fun"-0x60);}' > 1.c
      host% make 1
      cc -O -pipe -march=pentiumpro 1.c -o 1
      host% ./1
      unix
      host%

    6. Re:Is It Open to the Pros? by Anonymous Coward · · Score: 0

      Jeezus, the guy cut & paste the output from his compiler into his comment, and you ask him if he's "sure"? Of course he's bloody sure. Just because it worked for you... What's that got to do with him? Smack!

  9. Other languages than C by Stackster · · Score: 2, Insightful

    It's probably necessary to limit the contest to a specific language, but it would be cool to see a competition with other languages as well. Perhaps a limited set of "reasonable" languages (or everything will be written in esoteric (weird) languages (did anyone say Malbolge?).
    I'd really like to see obfuscated/weird code in a language less "obfuscatable" than C (maybe Java or somethingorother?).
    In that way, "obfuscation" can be more a matter of weird program flow and such, instead of confusing (but not very "interesting") a?b:c-statements (whatever they're called, I've forgotten it) and other C specialties.
    Obfuscation is more of a challenge if you don't have as many weird operators and such do go with, and you have to fool people some other way.
    Perhaps an Obfuscated Pseudo Code Contest?

    --

    There are 010 kinds of people. Those who understand octal, those who don't, and 06 other kinds of morons.
    1. Re:Other languages than C by Anonymous Coward · · Score: 0

      a?b:c

      Those are "tertiary" statements. And I use them all the time in Java.

    2. Re:Other languages than C by Westley · · Score: 1, Informative

      Ternary, not tertiary. (Or rather, the ? : operator is the ternary conditional operator. See JLS 15.28.)

      Jon

    3. Re:Other languages than C by tjgoodwin · · Score: 2, Informative
      If you think the IOCCC is mostly about ?:, then I don't think you've looked at enough entries! There is some truly twisted code in there, exploring every syntactic and semantic corner of the language.

      I doubt that other languages offer the same possibilities for befuddlement as C, but there's only one way to find out...

    4. Re:Other languages than C by jonathan_ingram · · Score: 1

      my favorite bit of C is the fact that a[b] and b[a] are equivalent. I remember the first time I saw a piece of code use '2[x]'...

    5. Re:Other languages than C by Dr.+Manhattan · · Score: 1
      I'd really like to see obfuscated/weird code in a language less "obfuscatable" than C (maybe Java or somethingorother?).

      Just throwing obfuscated code constructs at the program isn't enough to win these days. (I know, I've tried.) To have a realistic chance of winning, your code has to excel in several ares of obfuscation (style, algorithm, abuse of the rules) and show economy and elegance and do something non-trivial.

      Check out the winner last year that fit an entire X-Windows flight simulator into 1.5K of C code... can't link to it right now, but it's called "banks.c".

      I'm going to enter again this year. I've got a program that I've progressively improved over several iterations. I just thought of a few ways to shave some bytes here and there; maybe I'll have enough room to squeeze in a graphical output routine...

      --
      PHEM - party like it's 1997-2003!
    6. Re:Other languages than C by bill_kress · · Score: 1

      Actually, the trinary operator is extremely useful and can clean up code if used right. Also, it exists in Java.

  10. That WOULD be too easy by Greyfox · · Score: 3, Insightful

    I've written Perl and then come back six months later and been unable to figure out what it was doing. Perl is not the world's first Write Only Language (That honor might go to APL though) but it's certainly one of the better ones.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  11. Anecdote by mirko · · Score: 5, Funny
    The following event was related by ace@tidbits.com (Adam C. Engst).

    The highlight of the annual Computer Bowl occurred when
    Bill Gates,
    who was a judge, posed the following
    question
    to the contestants:


    "What contest, held via Usenet, is dedicated to examples of weird, obscure, bizarre, and really bad programming?"


    After a moment of silence, Jean-Louis Gassee (ex-honcho at Apple) hit his buzzer and answered:


    "Windows."


    Mr. Bill's expression was, in the words of one who was there, "classic."
    --
    Trolling using another account since 2005.
    1. Re:Anecdote by poot_rootbeer · · Score: 1


      This Computer Bowl story is true, BTW. I saw it on TV shortly after it happened. I marked out.

  12. Re:When will they start an obfuscated perl contest by myelin42 · · Score: 3, Funny

    There already is one!

    Also, if you go to Perl Monks, there are heaps of people submitting obfuscated Perl code for judgement ...

  13. There's this thing called a comment... by wiredog · · Score: 1
    nt



    Cat got your tongue? (something important seems to be missing from your comment ... like the body or the subject!)

  14. Recompilation of obfuscated Apache? by bodin · · Score: 1

    Either the IOCCC has already been slashdotted or the obfuscated source of Apache is in recompilation.

  15. Irony by Anonymous Coward · · Score: 0
    ..show the importance of programming style, in an ironic way..

    What's ironic is the fact that such a thing can be said about a programming language that was made cryptic by design so as to save on a few keystrokes here and there (at least that's what my C/C++ prof told us).

    "Gee, let's sacrifice readibility and ease of bug prevention/elimination for typing speed."

    Of course, my C/C++ prof was a few bits short of a byte...

    1. Re:Irony by hazem · · Score: 2, Insightful

      Don't forget, there was once a day where everyone didn't have 1Ghz processors, 21" monitors, and graphical debuggers.

      Yes C was written in one respect to save on key strokes, but that was when computers didn't have monitors - you punched keys (not so easy to press), and got your output on a teletype printer. God knows you wouldn't want to by typing Cobol programs this way.

      My guess is that programmers probably took more time designing their program before they started keying it in. C, with short commands, and abbreviated syntax only made it easier to get your darn program into the computer.

    2. Re:Irony by cdraus · · Score: 2, Insightful

      No, C is/was not designed to "save a few keystrokes here and there". It was designed to be able to be terse yes, and to not limit the programmer (Mr Programmer asks to do x and asserts: Yes, this is _really_ what I want to do), but it's got nothing to do with typing speed.

      Often C allows the programmer to express things in a short (terse) form that are intrinsically "obvious".. if it's not, then it's obfusticated; which is allowed too... but it's not the compilers job to decide what humans can and can't easily read.

    3. Re:Irony by Ayende+Rahien · · Score: 2

      No, that isn't what it was.
      C was supposed to be a better (portable, mostly) assembly, a lot of its contracsts can be translated directly to proccessor instructions.
      The most obvious thing is, of course, ++ and += type of thing.
      You must also remember that C as we know it today (C99) isn't at all what K&R C was.
      C actually got a lot of things from Pascal (function signatures, and variable types, frex) that made it a language much more suitable to write applications than it used to be. There was a reason why C was used to low level stuff up until the 90s, and why Pascal (or Borland's version of it) was so popular for so long.

      As a note, Ada programmers have contests for *clear* code.
      In a language that was designed to be as clear as possible.

      --

      --
      Two witches watched two watches.
      Which witch watched which watch?
    4. Re:Irony by cmowire · · Score: 2

      Actually, outside of deliberately confusing syntax, the relitive terseness of a langue really doesn't matter.

      For example, is it more or less readable to have a
      begin
      do something
      end

      vs. a
      {
      do something
      }

      ?

      Both are equally readable, one just takes fewer keystrokes.

      When you compare C to Pascal, you see how in every case, C is much more terse, but still, for the most part, readable.

      And there are things like..

      x++ or x += 2
      instead of:
      x := x+1 or x := x+2

      Granted, there are annoying idioms that hurt the readability of the code. The (a?b:c) construction sometimes falls into this range. Using x = (++a) + (b--) sort of idioms also falls into this range. But most of those are abuses of the language and not regularly intentional coding strategies.

    5. Re:Irony by bill_kress · · Score: 1

      Actually C is all about making the C compilier as simple as possible. For the most part, the terseness is a result of this.

    6. Re:Irony by chefren · · Score: 1
      x++ or x += 2
      instead of:
      x := x+1 or x := x+2

      In pascal, you use ':=' and not '=' to assign values, and thus reserve '=' for equality comparition instead of that horrible '=='. This, unfortunately is one of the things about C that Java should NOT have borrowed. On the other hand '=+' and '=-' are ok. 'a++' and 'b--' are also, but not when used in assignments:

      String copying from 'The C programming language' by K&R:
      while (*s++ = *t++);

      This neat little piece of code copies the string t to s. Scary..

    7. Re:Irony by cmowire · · Score: 2

      I have often thought about that the := vs. = and == vs = issue.

      And, really, either way you look at it, it's as orthogonal as possible.

      For == to be comparison means that it is similar to !=. Both are nice two character operators, and also parallel =, etc. are the exceptions in this case. This also means that, with = be assignment, +=, -=, etc. are orthogonal.

      := is more mathematically correct, because assignment has little to do with equality, so that makes things more explicit. Then = is what it means, and is orthogonal with . However, then you have to make # the not equal operator if you want the not equals to be similar in form, or you have to use either or !=. This also means that the += operators should be +:= to be unambiguous.

      The good thing, I suppose, would be to make := be the assignment and then make == the equality comparison, to make things crystal clear.

      Java makes the = vs. == error harder to do by the simple requirement that an if () take a boolean value instead of an int or bool.

      The best solution would be to switch to a unicode character set for programming, so that you could make everything perfectly regular and orthogonal. But that just plain sucks because you would need more keys on the keyboard or weird character combinations and the source would be a bitch to deal with.

    8. Re:Irony by statusbar · · Score: 2

      The reason for the silly ++ and -- operators is simply because of the lack of good optimizers long ago.

      "*s++ = *t++" directly maps to a SINGLE instruction on many CPU architectures. eg: 'move (a0)+, (a1)+'

      Those operators made it easier to make the compilers use the capabilities of the CPU.

      Today, optimizing compilers can and do figure this out all on their own.

      Number of keystrokes was not the issue. Too bad it has infected so many languages since. In fact, on some CPU's today just having the ++ and -- operators throws a monkey wrench into the optimizer as it does not allow for fine grained parallelism.

      --jeff

      --
      ipv6 is my vpn
  16. Here's my entry by Uttles · · Score: 1

    void main(){
    printf("hello world!");
    }
    If that's not obscure, what is?

    --

    ~ now you know
    1. Re:Here's my entry by Xiver · · Score: 0, Redundant

      How about the following?

      int x[100];

      for(int iApple = 0; iApple = 0; --iGrape){
      cout (int)(99 - iGrape[x]) endl;
      }

      --
      10: PRINT "Everything old is new again."
      20: GOTO 10
    2. Re:Here's my entry by jonathan_ingram · · Score: 1

      Entries to the IOCCC have to be legal C, and your program isn't: 'void main' isn't legal C.

    3. Re:Here's my entry by kryptola · · Score: 0

      i think your code doesn't compile anyways, and it's C++ code

      --
      "Trying is the first step towards failure" - Homer J Simpson.
    4. Re:Here's my entry by govtcheez · · Score: 1

      C++ code? Nope...

      Not ANSI code, but it is C...

    5. Re:Here's my entry by Anonymous Coward · · Score: 0

      What's cout? It's an instance of ofstream, a _C++_ class. What's the << operator? It's an overloaded operator member of the _C++_ class ofstream. What's endl? It's a constant that tells an ofstream instance to write an endline and flush its fstream.

      Let's assume that your friend redefines cout as a C function. His code still won't compile because of the stray endl after the function call.

    6. Re:Here's my entry by Evangelion · · Score: 1


      You're forgetting that you're allowed to specify the compile time flags. So passing -Dvoid=int to cpp would fix that, and make it a legal entry.

  17. My favourite obfuscation by jasoegaard · · Score: 2, Funny

    My favourite obfuscation is this pi-program.

    The only thing in main() is large drawing of a filled circle. And then it says

    "If you want better accuracy, make a bigger drawing"!

    --
    -- A Mathematician is a machine for turning coffee into theorems. - Paul Erdös
    1. Re:My favourite obfuscation by Make · · Score: 1

      It's not in the main function, it's in the F_OO function. But still quite cool, I'll try to compile and run it later when I have a break ;)

    2. Re:My favourite obfuscation by skajohan · · Score: 2, Funny
      I'll try to compile and run it later when I have a break ;)

      Because you're now busy doing your job by reading Slashdot?

    3. Re:My favourite obfuscation by Anonymous Coward · · Score: 0

      mmm it said:
      3.156

    4. Re:My favourite obfuscation by Anonymous Coward · · Score: 0

      I get 3.156...s'OK i s'pose...

  18. pffft C is too easy to obfuscate by kuiken · · Score: 0, Offtopic

    now obfuscated cobol that would be a chalenge

    --

    42
  19. Why Blame the Russians? by Anonymous Coward · · Score: 1

    In the early days of programming this was almost standard practice, EVERYWHERE!

    In the early days, IBM used to have "aptitude tests" that asked candidates whether they liked the "puzzles", e. g., in the newspapers and gave tests to evaluate this kind of "skill".

    It took only a short step for programmers to realize that all programs could be written as "puzzles". If weak management accepted this, then you have Microsoft!

    Now you know why all those old, old programs look the way they do!

  20. Re:When will they start an obfuscated perl contest by Anonymous Coward · · Score: 0, Funny

    perhaps an unobfuscated one for that little canines snack of a language?

  21. Re:When will they start an obfuscated perl contest by geirt · · Score: 2

    No need to, I have found a perfect auto obfuscater, it's called cat(1) ....

    --

    RFC1925
  22. Re:When will they start an obfuscated perl contest by microTodd · · Score: 2, Informative

    There already is one.

    http://www.sysadminmag.com/tpj/obfuscated/

    --
    "You cannot find out which view is the right one by science in the ordinary sense." - C.S. Lewis on Intelligent Design
  23. Re:my fovorite (Even Better) by Xiver · · Score: 1

    int X,x[100];

    for(X = 0; X < 100; ++X){
    X[x] = X;
    }

    for(;X > 0; --X){
    printf("%d\n", (int)(100 - X[x]));
    }

    --
    10: PRINT "Everything old is new again."
    20: GOTO 10
  24. You wanna see really obscurifacted? by cdraus · · Score: 2, Interesting

    check out this

    and look under the C link.

  25. 1990 winner by Lussarn · · Score: 5, Interesting

    This is the 1990 winner. A complete basic interpreter. For fun I unobfuscated this code (Took a couple of hours). it's really a piece of art. several commands. Variables. Parentesis and operator precedence. Cool Stuff.


    #define O(b,f,u,s,c,a)b(){int o=f();switch(*p++){X u:_ o s b();X c:_ o a b();default:p--;_ o;}}
    #define t(e,d,_,C)X e:f=fopen(B+d,_);C;fclose(f)
    #define U(y,z)while(p=Q(s,y))*p++=z,*p=' '
    #define N for(i=0;io&&!*z)_ x;}_ 0;}main(){m[11*R]="E";while(puts("Ok"),gets(B)
    )switch(*B){X'R':C=E;l=1;for(i=0;i",'#');U("=",' !' );}d=B;while(*F=*s){*s=='"'&&j
    ++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(* B){X'E':l=-1
    X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B) ,P [*d]=S():(*(q=Q(B,"TH"))=0,p
    =B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,pu ts (B+6):(p=B+5,printf("%d\n",S
    ()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
    =B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]',>)O(K,V,'$',=)
    O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p

    1. Re:1990 winner by Lussarn · · Score: 2, Informative

      Grab it here instead. The source where cut in the post.

    2. Re:1990 winner by Anonymous Coward · · Score: 2, Insightful

      I've always wished that they'd post an analysis of the various techniques used in each program. Sometimes the authors will explain some of the tricks they used, but it seems that most submitter's attitude is figure it out yourself.

    3. Re:1990 winner by Anonymous Coward · · Score: 0
      Would you care to post the unobfuscated version of it (or a link to it) too? I would really like to see that. Thanks!

      Sorry for posting as an AC. My account is bit of a mess.

    4. Re:1990 winner by Lussarn · · Score: 1

      I have it at home if I haven't deleted it (I'm At work now). Check back in about five huors from this post and I might provide a link.

    5. Re:1990 winner by Anonymous Coward · · Score: 0
      alas... he was hit by a bus with time to cuss and not to boast but he didn't have time to post...

      ...unlike me.

    6. Re:1990 winner by seann · · Score: 0

      is this susposed to compile?
      is compile spelt right?

      (sips back more coffe)

      --
      I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
  26. Re:When will they start an obfuscated perl contest by Andrewkov · · Score: 2

    All Perl programs are basically obfuscated, so a contest is not needed.

  27. a couple of my favs by gosand · · Score: 3, Interesting
    I have had these for a while now, not sure where I got them. I tried to post the source, but it wouldn't let me. Check them out.

    When compiled and run, it prints out the 12 days of Christmas.

    12days.c

    And this one is has very interesting source, I think it calculates pi.

    pi.c

    --

    My beliefs do not require that you agree with them.

    1. Re:a couple of my favs by rabidcow · · Score: 1

      This one is funny: http://www.ioccc.org/1990/westley.c
      No clue what it does, but it's arranged as a series of letters.

      And you've gotta read the hint file for http://www.ioccc.org/1995/heathbar.c.

      I can't find the one I wanted to link to... It was a program to print a maze, in the shape of a maze, that spelled the word "MAZE". Quite beautiful.

    2. Re:a couple of my favs by noc · · Score: 1

      pi.c is one of those classics that's just to beautiful to describe. It's actually one of the easier winners to figure out (so I guess it's not *too* obfuscated), but it's so wonderful you can't help but to adore it. Can you figure out how it works? Here's a hint: carefully increase the size of the circle. You'll get a more accurate approximation of pi. Incredible.

  28. Damn it Jim! by Greyfox · · Score: 3

    I'm a computer programmer, not an English major! If I wanted to write English in my programs, I'd use COBOL!

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    1. Re:Damn it Jim! by Amazing+Quantum+Man · · Score: 2

      You don't use COBOL, you use the Object-Oriented version:

      ADD 1 TO COBOL STORING THE RESULT IN COBOL

      --
      Fascism starts when the efficiency of the government becomes more important than the rights of the people.
  29. If you want a really obfuscated languange.. by elvstone · · Score: 1

    You should take a look at the Shakespeare Programming Language, or SPL for short. It combines the best features of BASIC, assembly language, and Hamlet. In SPL, every program is a play, and the plot closely follows the program execution. You can program SPL for a living during the day, then come home and read the source code as a good-night story.

    How's that for obfuscation?

  30. Abuse of the rules by DeadMeat+(TM) · · Score: 2
    The best ones have always been those that abuse the rules, the compiler, or both.

    A few years back somebody submitted the definitive self-replicating (i.e. prints its own source code) program. It consisted of a 0-byte C file. The author pointed out that even though it's not technically a legal C program, most C compilers (including the one the IOCCC uses) will in fact accept it and proceed to spit out a binary that does nothing.

    The most evil entry though has to be the Spinellis entry from 1988, which consists of the line #include "/dev/tty". This actually caused a change in the rules so that programs can't require user intervention to compile anymore, short of running make.

    1. Re:Abuse of the rules by Anonymous Coward · · Score: 1, Informative

      The author pointed out that even though it's not technically a legal C program, most C
      compilers (including the one the IOCCC uses) will in fact accept it and proceed to spit out a binary that does
      nothing.


      Let's see:

      # touch test.c
      # gcc test.c
      /usr/lib/crt1.o: In function `_start':
      /usr/lib/crt1.o(.text+0x18): undefined reference to `main'
      collect2: ld returned 1 exit status

      Doesn't work anymore.

    2. Re:Abuse of the rules by joshwalker · · Score: 2, Informative

      There are some good examples of quines (self-replicating programs) at http://www.nyx.net/~gthompso/quine.htm

      Also, I like Esoteric Topics in Computer Programming

    3. Re:Abuse of the rules by polymath69 · · Score: 1

      Sure it does. You forgot the -c switch.

      $ touch test.c
      $ gcc -c test.c
      $ ls -l test.?
      -rw-r--r-- 1 .. 0 Oct 2 16:09 test.c
      -rw-r--r-- 1 ... 488 Oct 2 16:09 test.o

      Null code will compile.. it just won't link on its own.

      --

      --
      I don't want to rule the world... I just want to be in charge of mayonnaise.
  31. Re:When will they start an obfuscated perl contest by Quila · · Score: 0, Redundant

    Isn't that redundant?

  32. writing bad code by tinkerton · · Score: 1

    Not in my short experience. The Russians i work or worked with have high standards for readability. Sometimes weak knowledge of english causes misunderstandings.

    Once upon a time and once upon an office?
    It must have been tried somewhere, maybe in Russia. And then they start sweating to get the bugs out.

    The best way to make the code hard to decipher is to put a bad programmer on it. Although, in lisp...

  33. Don't bother, its slashdotted... by bteeter · · Score: 1

    Anyone got a mirror site/link?

    Brian
    --
    100% Linux Based Web Hosting

  34. Re:hare-brained by dstone · · Score: 2, Funny

    H4R3-br41N3D, not hare-brained, not hare-braned, not hare braned, not hair brained.....

  35. Yeah, that's classic by Anonymous Coward · · Score: 0

    That's not even funny. Were you born with part of your brain missing?

    1. Re:Yeah, that's classic by Anonymous Coward · · Score: 0

      Yep, that's why they gave me yours to compensate.

    2. Re:Yeah, that's classic by Anonymous Coward · · Score: 0

      hahaha nice reply :-)

  36. BZZT by Craig+Davison · · Score: 2, Informative

    No, C was designed to limit the number of keywords required. There's a huge difference. Compare C to pascal. C has less than a dozen keywords and Pascal has almost 100, but neither is more readable if used correctly.

    Also, C was not popular until we already had video terminals - and then, C was the UNIX-head-only language until the 80's.

    You're so incredibly misinformed about computer history.

  37. Oops by govtcheez · · Score: 1

    Whoops - my mistake... I'll learn to read eventually, I promise!

  38. Re:When will they start an obfuscated perl contest by Anonymous Coward · · Score: 0

    Why is it so hard for perl programmers to indent their code? I can't even begin to count the number of times I've had to use CGI scripts where every line was in column 1.

  39. Re:When will they start an obfuscated perl contest by Indomitus · · Score: 1

    If you'd ever seen the works of art that come out of the Obfuscated Perl contests that already exist you wouldn't say it's easy. Some of the stuff those guys come up with blows your mind in terms of invention and thoughtfulness. Just because Perl has weird syntax to people brought up on C doesn't make it pre-obfuscated and doesn't reduce the genius behind some of the crazy code I've seen come out of those contests.

    Go to perlmonks.org and search for 'obfuscated' or 'perl golf' and you'll see what I mean. The original Perl Golf game was to find a word in the dict file that had 10 non-repeating characters and the winner was a solution that was only 14 characters worth of code. Now that's cool.

  40. Re: Good ole American obfuscation by KenHuffman · · Score: 1

    At a previous employer, we had a home-grown database system (written in IBM mainframe assembler). We were a non-profit company, and perhaps because some of the development was paid for by the government, there was some stipulation that the source code back then had be made available to qualified parties.

    Worried that we would lose our intellectual property, the company hired a consultant to determine the best way to obfuscate the code before sharing it. After looking over the code, the consultant noted that we didn't need to do a thing to it to prevent others from understanding it!

    Ken (a 1997 winner of the IOCCC)

  41. new to this contest by chongo · · Score: 5, Informative
    As part of the IOCCC tradition, we always tweak/adjust the rules and guidelines each year. Noteworthy changes for the 16th contest include:
    • New max size limits: 4096 (was 3217)
      (We gotta keep up with the code bloat like everyone else :-) :-()
    • New max size for non-whitespace / non {:} chars: 2048 (was 1536)
    • New max compile/build line: 521 (was 255)
      (why 521? Well 521 is prime and 2^521-1 is a Mersenne prime and I like primes ... :-))
    • We now allow people to use OpenMotif
    • MS gets two pot shots directed at it in this contest (yet another tradition)
    --
    chongo (was here) /\oo/\
  42. Re:and the ever popular by slickwillie · · Score: 2

    (boolean expression) ? TRUE : FALSE;

  43. I have wanted to ask... by h2odragon · · Score: 2, Funny

    "Ken (a 1997 winner of the IOCCC)"

    Do you point this accomplishment out to prospective employers? Do they view it as a positive thing? :)

    1. Re:I have wanted to ask... by KenHuffman · · Score: 1

      Yes, it is on my resume. (It is a great interview topic.)

  44. Re:my fovorite (Even Better) by Anonymous Coward · · Score: 0

    Worst code ever!!! (in the voice of Comic Book Guy).

    You really haven't got a clue.

  45. Unobfuscaters? by scott1853 · · Score: 2, Funny

    I could really use an unobfuscater to translate all the code I write at 3:00am while on a Jolt/Vivarin high.

    It would also come in handy when I have to look at the code the interns wrote.

  46. Best of IOCCC by chongo · · Score: 1
    Yes, your 1990 Best Language Tool was an outstanding entry. It was one of several of outstanding wins that I have had the pleasure of judging over the years.

    However, the greatest and longest laugh at a IOCCC BOF occurred when I presented your 1998 Best abuse of the rules. For those you were not there, his entry consisted of a single, simple Un*x portable line of code:

    #include "/dev/tty"
    That Truely twisted entry is listed in my top 10 all time best IOCCC progs.
    --
    chongo (was here) /\oo/\
  47. The 1998 flight simulator by chongo · · Score: 1
    FYI: The 1998 X-Windows flight simulator, along with a sample data file, is on-line. The server is a little slow, but you should be able to fetch it.

    FYI: This year we are allowing use of OpenMotif which should improve things for folks writing new X-Windows progs.

    --
    chongo (was here) /\oo/\
    1. Re:The 1998 flight simulator by Anonymous Coward · · Score: 0
      folks writing new X-Windows progs

      Any program for the X Window system is automatically obfuscated. You don't need a contest for that.

  48. Very old idea: Job security by devphil · · Score: 2


    Heck, that's not unique to Russians. It's alive and well in the West, that's fer damnsure.

    Go to the Jargon File (www.jargon.org), and look up "job security".

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  49. Stress test C Compilers? by chongo · · Score: 2, Informative
    Typically each year we find that at least 1 entry that will cause someone's C compiler to dump core or go haywire.

    Over the years, gcc has survived the best. It has chucked core cookies on a few entries, but not nearly as often as some of the commercial C compilers.

    If a winning entry does cause problems for somebody's C compiler, we usually file a bug report. They may not be pleased with the code sample, but that is the break;'s. :-)

    p.s. The entry that broke causde the most problems on the most platforms was the 1988 Best of show. Not only did it crash a few C pre-processors, it cause one system to turn casters-up when it ran out of swap space!

    --
    chongo (was here) /\oo/\
  50. Seg: readable perl by TMB · · Score: 2

    Segfault had a classic article about the First Annual Readable Perl Contest about a year ago... :-)=

    [TMB]

  51. Re:When will they start an obfuscated perl contest by Loligo · · Score: 2, Funny


    Perl takes me back, though.

    Every time I look at someone else's perl, I expect a line to end with "NO CARRIER"...

    -l

  52. Not just in the early days by Anonymous Coward · · Score: 0


    Actually, I interviewed at IBM just a couple of
    years ago and they gave us an "information processing test"; i.e. given a grid of letters, find the second vowel down from the third "f" encountered traversing the perimiter in counterclockwise order starting from the upper left, and so forth.

    They made me an offer so I guess I passed :)

  53. Re:and the ever popular by crysogonus · · Score: 1

    Today I found this snippet of code:
    bool func()
    {
    if (true)
    return true;
    else
    return false;
    }
    (Well, the function once was useful and instead of completely erasing it, it was changed to this)

  54. Re:and the ever popular by Mr.+Sketch · · Score: 1

    Actually that code does serve a purpose when programming on Windows/MFC/C++ systems. In MFC, TRUE is defined as the integer constant '1' and FALSE is defined as the integer constant '0'. Whereas the return from the boolean expression will either be the C++ boolean value 'true' or the C++ boolean value 'false'. And depending on the warning level of the compiler, it will complain/mention that you're converting a boolean to an integer, so adding the ? TRUE : FALSE will eliminate the warning.

  55. Re:and the ever popular by slickwillie · · Score: 2

    So I guess it's not really a "C compiler, is it?

  56. Re: Good ole American obfuscation by GiMP · · Score: 1

    There was no 1997 IOCCC, there was an entry in 1996 by a Ken Huffman.. I am sure this is what you meant ;)

  57. Re:When will they start an obfuscated perl contest by scrytch · · Score: 2

    Look no further

    This is a bunch of text to get past the "lameness filter". I'm tempted to make some pithy witticism about the basic lameness of lameness filters, but this should be sufficient.

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
  58. APL: naturally obfuscated... :-) by Aldreis · · Score: 1


    I humbly cast my vote on APL... It is a symbolic, naturally cryptic ( warning: big gif of the non-ASCII charset ) language, delightful to use ( once you really grokked it ) just because of the amazing power of its one-liners...:-)

  59. Re:When will they start an obfuscated perl contest by yason · · Score: 1
    When will they start an obfuscated perl contest? Or would that be too easy?;)

    Yes, that'd be to easy. Just any perl code would do. We could have a contest of the most readable, self-documenting and clearest perl code, though. But, then again, that might be too hard.

  60. Re:Is It Open to the Pros? (SPOILERS) by ChadN · · Score: 2

    no casts or type conversions, really. Just know that:

    #define unix 1 /* default on unix systems */

    (unix)["have"]+"fun"-0x60) == &("fun"[("have"[unix] - 0x60)]) == "un";

    and the rest flows pretty easily. I was amazed by its simplicity once I figured it out (after reading the hints and lots of pondering w/ the C manual). And yes, it does use your favorite trick... ;)

    --
    "It's overkill, of course. But you can never have too much overkill." - Anonymous Slashdot Coward
  61. Correct by DreamerFi · · Score: 2

    I was in the audience at that time. Note that most of the audience walked in were actually Mac developers. It was held in the same week, and across the street from, the World Wide Developer Conference held by Apple in San Jose.

  62. Re:and the ever popular by John+Sullivan · · Score: 1
    so adding the ? TRUE : FALSE will eliminate the warning.

    If you're using COM interfaces it gets worse than that. The VARIANT_BOOL data type is defined as a 16-bit word taking the values False (0) and True (-1). As long as you test these against false there's not usually a problem, but if you test equal to true rather than is true, or if you negate the variable then weird things can happen. VB's Not operator blindly does a bitwise rather than logical negation even on Booleans, so if you take a Boolean variable (badly) returned from a COM object written in C++ it's entirely possible for both the following statements to get executed:

    If var Then DoThis
    If Not var Then DoThat

    Solution: always return COM booleans from C++ using the idiom (var ? VARIANT_TRUE : VARIANT_FALSE)

    --
    This is my World Wide Web of Whatever
  63. Simple enough... by J'raxis · · Score: 0

    for(;;)fork();