15th IOCCC Results Posted
leob writes: "FWIW, the 15th International Obfuscated C Code Contest finally came to a conclusion. Read the main page, or, get one big tarball." The contest took a little longer than expected, but the results are fine example of their craft.
What use is this? Surely winning this competition is a sign you should never work again? Obfuscated code (aka elegant) is no faster, even if it is shorter, and may even compile into worse code.
Well, (IMO) you're completely wrong. IOCC code isn't just "bad code getting awards". the winners of the IOCC show an understanding of the subtleties of the way the C language work far beyond that of your average C programmer, or even your pretty good C programmer. Or, to quote Peter Van Der Linden, "..[The IOCC] is a lot of fun and can extend your knowledge in surprising ways".
Spend a few hours or looking through the archives at things like "best one liners" and try and figure out what they do without reading the description - or maybe look through gems like the 1500 character BASIC interpreter. Deobfuscate some entries to figure out how they work and you might find you learn something about what the language can do and it might improve your day to day programming.
For me this shows the problm with open source - people are more interested in playing silly games than actually getting something constructive done.
Yuk, Trollish.
Removing all whitespace from code (or formatting code into ASCII pictures) is useless and annoying. Congrats to the winning submissions which were formatted reasonably and were still obfuscated.
I suggest slashdot team to mirror any link before it gets posted on the front page
I wonder if they'll make a translation of The Bible in c code syntax? ...
while(1)
hangOnCross(); ..
Or The Iceman Cometh: ...
while(!ANY_HOPE) {
if(have_coin || bartender_will_put_on_tab) {
getDrink();
}
if(HUGO)
say("DON'T BE A FOOL! BUY ME A TRINK!");
else
ignoreHugo();
have_coin = begPatronsForADollar();
bartender_will_put_on_tab = begHarryForADrink();
} ...
The point was more that MS have some sort of idea about quality code, not that they produced the One True Programming Book.
Anyway, please name some (no, really) - I've been looking around for books that cover the practice of programming, not a language reference or tutorial, and not a specific discipline. All I really came up with is Kernighan's Practice Of Programming, and some of Programming Pearls. They also both share Solid Code's anecdotal style, which I liked.
Re: Hungarian Notation - anyone whoe learned Windows programming early, from Petzold would have soaked it up - I know I did for Windows programming - although I don't do a lot of that at the moment. I suspect it's around more than you think, particularly in the windows world.
"don't fall into the fallacy of believing that Perl can solve social problems. Maybe Perl 6 can, but that's a ways off"
I really enjoy the IOCCC, and every year I download the results and play with them. Some are startlingly clever, like the flight simulator a couple of years ago. Writing these obfuscated programs is a special skill, and, yes, it is a form of craftsmanship within the context of the competition. And, of course, the people who can write these little gems have to be brilliant programmers first.
But in all normal circumstances, obfuscated code in any language is bad code . The whole purpose of highlevel languages is to communicate with human beings, not to communicate with the machine: to communicate with the programmer who is to come after you, who has to debug your code, or port it, or update it because some library it uses is obsolete and some of the API has been deprecated or dropped. That programmer may of course be you.
Code that can't be picked up by someone else in six months time - someone possibly less skilled than yourself, and read, and understood, and modified, is poorly crafted. Bad workmanship. If you can't understand this, you aren't going to be a successful member of any development team, either commercial or open source.
Enjoy the IOCCC as a cort of cross between puzzle games, satire, and poetry. A very special kind of programming - a very skilled kind of programming - but one which has virtually no carry-over into the real world.
I'm old enough to remember when discussions on Slashdot were well informed.
So a corporatist government combined with thousands of groups whose sole stated interest is to screw the consumer out of as much money as possible is better? How does that make any sense?
Because governments have the force of law, and corporations do not. There is no law requiring me to use Microsoft software, Xerox copiers or Blue Shield medical insurance. Better that I have the freedom to choose the honest companies over the dishonest ones, rather than being screwed 100% of the time, by law, by the government.
--
Sometimes it's best to just let stupid people be stupid.
chongo (was here)
If I were in charge of hire'nfire, I'd see winning the IOCCC as a definite plus. . . to write a well-obfuscated C program takes good knowledge of C and a love for programming, are both hopefully Good Things in the eyes of an employer.
but obfuscated code still doesn't seem as impressive to me as a good ol' 4k intro.
Maybe it's the pretty pictures. . .
> So if someone disagrees with you, then they must be a troll?
First, if you did not want to play a troll here, you'd better have choosed a different nickname. "Reality Master 101" ?
Second, I use troll as a compliment.
Third, agreeing, disagreeing to a post content don't really mean anything. I hope you don't think your opinions are accurately represented in a few hundred of bytes.
> Guess what? It's a product. You can choose to buy that product or not. We're not talking about food or housing
Guess what ? Food, housing, health care, education are all products. So your 'it's a product' is basically casted to void.
> we're talking about a movie in a particular format. Note that it isn't even the only format you can buy
Is it ? <http://www.amazon.com/exec/obidos/ASIN/B000053 VBN/ref=v_dh_hir_6/107-9806512-4018115>
In 5 to 10 years, movies won't be released on VHS anymore. Don't pretend you don't know this.
> It's their product. They can do whatever they want with it.
The problem is that, when we have bought such product, DMCA will prevent me to say "It is my product. I can do whatever I want with it".
> It's called "freedom"
Yeah. The freedom to buy politician. The freedom to push scelerate laws. The freedom to replace the word 'citizen' by the word 'consumer'. All that kind of freedom.
> But since you appear to advocate socialism, freedom is a word you may not be familiar with
Please, don't assume anything.
> > There is no such thing as an honest (or dishonest) company. Don't anthropomorphize.
> You know what I mean, but instead you choose to deliberately pretend that you don't rather than make a substantive argument.
No. You choosed not to understand what I said. Let me repeat:
"There is no such thing as an honest (or dishonest) company. Don't anthropomorphize"
Like in:
'It's their product. They can do whatever they want with it. It's called "freedom"' You are confusing freedom of citizen with freedom to trade. Those concepts are totally different. You are anthropomorphizing corportations. Honesty dishonesty, freedom.
Companies are not honest or dishonest. They can't be. Even if they spend hundred of million to build a corporate image, a company have no moral standing. Not even the slighest one. They can't have. By definition.
Let's go to your original post:
> I have the freedom to choose the honest companies over the dishonest ones
I'd say that freedom is a word not familiar to you. The synonym 'liberty' would be more appropriate in your sentence. Freedom have connotations you don't seem to grasp. In particular, "the condition of being free of restraints". An _alternative_ between compeeting _corporations_ giving you _liberty_ of _choice_ don't carry most of the meanings of _freedom_.
Cheers,
--fred
1 reply beneath your current threshold.
Comments? Questions?
Thad
Thad
seebs ? Peter Seebach ? Recall of endless discussion on comp.lang.c, in (iirc) 1991/1992. You and Dan Pop are responsible of most of my C pedantry :-)
Nice to heard you again, a bit sad that you are not using a flamethrower against void main()...
Cheers,
--fred
1 reply beneath your current threshold.
Yes, thank you. I have posted a correction.
These programs aren't hard to decode, spend a little time on them and it's not that hard. I'm thinking they were written using standard formatting (if there is a standard) and then tweaking them so they look unreadable.
At first glance of the code, it looks completely unreadable and worthless, until you compile it and realize it actually works! Genius.
I have a hard enough time doing regular programming, I shudder at the thought of trying to make something like this.
I like the fact that this is a very good way to confuse people and just plain annoy them when someone asks for your source code and you know they're just gonna copy it and slap their name on it and pretend they wrote it. Makes good presents too. "Here's that game I wrote blah blah, just read through it and tweak the settings." he he.
Too bad the site is already slashdotted. Later all
Lord Arathres
stainless steel
Oops. Forgot to answer the question. The thing uses the Spigot Algorithm, by Stanley Rabinowitz and Stan Wagon.
See (for instance) <http://www.physik.tu-muenchen.de/lehrstuehle/T 32/matpack/html/Mathematics/Pi.html> to get a description. Remove slashdot added spaces from the URL.
So, definitively, no. You won't be a contender with an extremly common stolen program.
Cheers,
--fred
1 reply beneath your current threshold.
I would have to agree that simply rendering a program into ascii art is not itself obfuscation, and therefore, does not properly belong in this contest. On the other hand, I would tip my hat (if I had one handy) to anyone who can write a workable C program that doubles as ASCII art. This probably deserves a contest all of its own.
Remember, you saw it on Slashdot first.
Hopefully I didn't put any [] around my words.
I know you just wanted a cheap shot, and hey, this is the audience for it, but I would suggest you read either Writing Solid Code or Code Complete, both published by Microsoft Press, and both supposedly based on internal MS coding practice. They are very good examples of the ways in which you can write easy-to-read, easy-to-debug, easy-to-maintain code.
Regardless of what the front office does and decides as a direction, there are some pretty clever people at Microsoft (not to mention Microsoft Research - Blinn, Kajiya, Gray, and many others).
(of course, feel free to add a more illuminating comment if it wasn't just the usual MS==BAD)
"don't fall into the fallacy of believing that Perl can solve social problems. Maybe Perl 6 can, but that's a ways off"
And only later did a good answer occur to me--a high tech twist on an old proverb. "There is one beautiful program, and every programmer has written it."
The original of course is, "There is one perfect child, and every mother has it."
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
Hey, try actually having a boss who won the IOCCC...three times, even...
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
(bored, so I'll reply to that. I'll spend a couple of minutes, and practice my poor english).
Hi, reality master 101, how is your trolling session today ?
> There is no law requiring me to use Microsoft software
Wrong. Take DeCSS as an example. If you own a PC you are required to use Windows to view your DVDs. Law is here to enforce that. DMCA will give a new meaning to this. The law will not say "you are required to use window", but "it is illegal to use software non-approved by the industry", and, funnily, the industry will only approve windows software.
Sure, you can say that there is no law that forces you to buy a PC (at least now). In that case, there is no law that requires you do do anything, as you always have the possibility of reject your American citizenship.
> I have the freedom to choose the honest companies over the dishonest ones
There is no such thing as an honest (or dishonest) company. Don't anthropomorphize.
Cheers,
--fred
1 reply beneath your current threshold.
The whole point of any computer language is to get the friggin machine to do something. Maintabilty is a desirable extra I'll admit but nice looking code that does fuck all is pretty useless.
Special Relativity: The person in the other queue thinks yours is moving faster.
(audience: "Boo!!! Hiss!!! Don't quit your day job!")
I'm a leaf on the wind. Watch how I soar.
So, download the file from http://www.ioccc.org/2000.2000.tgz
I've got to say that anderson is particularly satisfying, no #defines and I still can barely understand a character of it...
Special Relativity: The person in the other queue thinks yours is moving faster.
Can some brave soul who managed to grab the tarball please mirror it? It's your very own chance to be Slashdotted. :-)
SMQ 90AE4B2BC4F6BEAF7340F0B40BA2DEF7340F6BC2D0392
..people were asking for elegant code yesterday!
Very cool but...
What use is this? Surely winning this competition is a sign you should never work again? Obfuscated code (aka elegant) is no faster, even if it is shorter, and may even compile into worse code.
For me this shows the problm with open source - people are more interested in playing silly games than actually getting something constructive done.
Microsoft didn't get to be as successful as it did by creating obfuscated code you know.
I am new to programming, so no flames please. Can something like this be ported to Perl? (I am trying to learn it.)
Yes, this can be ported to perl. Anything in C can be written in perl (and vice versa).
C is weakly typed, so I'm not sure what you're getting at here... Strong typing is to save the programmer from himself. I personally do not enjoy programming in languages that remove C's power to make non-sensical casts.
So, I guess what I am really asking is: Is this kind of program only able to be written well in something like C++ or Java?
Absolutely not. This is just an algorithm for calculating Pi. C is nice because it's portable and fast. Check out a functional programming language like Haskell. Selecting a programming language for a particular task involves clearly stating your goals. If I wanted to confuse you, I'd write it in Malbolge or BrainF*ck. If I wanted to calcuate pi quickly (millions of digits), I might write it in C, but I'd also do my homework. If I wanted something from the command line, I'd use:
$perl -e 'for(0..9999){$i=$_*8;$p+=(16**-$_)*(4/($i+1)-2/($ i+4)-1/($i+5)-1/($i+6))}print$p'
It's really a matter of "what gets the job done."
(Besides that I have a feeling that using an object-oriented language (like Visual C++) would reduce the amount of code you would have to write (due to increased code re-use.))
Simple algorithms like this one are fairly atomic. You're foo class isn't going to help you here. You really aren't going to resuse this either. That's what M_PI is for =).
What's the point?
It's silly!
It's funny.
That's about it. It isn't designed to be taken seriously. MTo make you look at it, and go, what the hell does THAT do?
It calculates PI and the AC poster ripped it off from post #3, by crovax, in the IOCC delayed" story.
I think we let a couple of void main()'s through, but I don't know that we will next time; we may even just point it out in the rules.
My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
I'm a Pascal (and Pascal derivatives) lover, personally. I don't like C even slightly, I'm afraid. Might be fine for what other people want to do but definitely isn't for what I want to do.
So. My first instinct when I saw this was Ha! More examples of just why C is horrible! You couldn't do this if in Pascal if you tried!
I then thought about the ingenuity of these authors...
So, does any such resource exist for Pascal code? Beyond simply putting the thing as ASCII art and giving it meaningless variable names, neither of which seem truly worthy to me.
Greg
(Inside a nuclear plant)
Aaaarrrggh! Run! The canary has mutated!
judging by the ASCII art it renders, I'd say it has something to do with semaphores...
"The world doesn't really need more busy people, maybe not even more intelligent people. It needs 'deep people'..."
A few entries that I saw were mostly c programs converted to ascii art, which I believe is a pity as if reindented correctly this would not look as obfuscated as in previous contests. ;-).
I however enjoyed some entries, like PrimeNum which is an example of clean obfuscated code, despite its heavy use of preprocessing directives (BTW, even its own name is obfuscating as it has not much to do with prime numbers, even though its apparent algorithm is
Tomx is also interesting as it is a Makefile and a source file at the same time.
--
Trolling using another account since 2005.
Only under such a deranged set of principles would anybody refusing to scam his fellow (wo)man out of anything and everything be lauded as a role model or praised as a pillar of society. Don't even get me started on Forbes magazine's little list....
Only under such a deranged set of principles would anybody attempting to scam his fellow (wo)man out of anything and everything be lauded as a role model or praised as a pillar of society. Don't even get me started on Forbes magazine's little list....
Someone should start an 'Obfuscated Law' contest for the various corporate (and otherwise) entities in the computer/IT/media industry which best exemplifies the qualities of obfuscating the law for their own personal gain. For example, the MPAA for successfully sueing to shut down the distribution of DeCSS by claiming a string of text to be an illegal circumvention device. Or CMGI (Altavista) getting patents on typical internet indexing and searching and then sueing everybody.
I think it calculates pi (3,1415..) quite exactly :-)
What is the point of this? Most of the code I've seen in the past uses some pre-processor tricks to un-obfusticate the source.
I once saw some obfusticated Perl which appeared to be no more than a standard perl program with all whitespace removed, no comments (naturally), and over-use of $_.
Then again I was attempting to revise one of the sound drivers in the current Linux kernel recently, and that was pretty well obfusticated!
How in the world could you know anything about Microsoft code, unless you work for them? They could code in hex (yeah, riiight) and no one would be able to tell from the binaries anyway.
The bit about Open Source . . . you get all these interesting 'games' as you call them, but to me that's people being interested in what they do! An important principle of Open Source or Free Software is that people love to code.
"Strange how much human accomplishment and progress comes from contemplation of the irrelevant."
- Scott Kim
Can we get a "-1 Wrong" moderation option?
> Think I could have be a contender?
Nope. Even in obfuscated C, main cannot be declared void.
Btw, you should give credit to the original author of this program, Dick T Winter. (Which btw, did not put the 'void' before main())
Cheers,
--fred
1 reply beneath your current threshold.