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. :-)"
To stress C compilers with unusual code
Some compilers become stressed easier than others.
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"
Anybody notice the 'A is for ASCII, B is for Byte' stuff on the winners index?
link
"Draco dormiens nunquam titillandus."
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.
Or would that be too easy?;)
Oh, wait, that's perl, isn't it?
A feeling of having made the same mistake before: Deja Foobar
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?
I wonder if Bill Gates will enter.
You die too easily.
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.
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?
The highlight of the annual Computer Bowl occurred when
Bill Gates,
who was a judge, posed the following
question
to the contestants:
After a moment of silence, Jean-Louis Gassee (ex-honcho at Apple) hit his buzzer and answered:
Mr. Bill's expression was, in the words of one who was there, "classic."
Trolling using another account since 2005.
There already is one!
...
Also, if you go to Perl Monks, there are heaps of people submitting obfuscated Perl code for judgement
Cat got your tongue? (something important seems to be missing from your comment
Best Slashdot Co
Either the IOCCC has already been slashdotted or the obfuscated source of Apache is in recompilation.
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...
void main(){
printf("hello world!");
}
If that's not obscure, what is?
~ now you know
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
now obfuscated cobol that would be a chalenge
42
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!
perhaps an unobfuscated one for that little canines snack of a language?
No need to, I have found a perfect auto obfuscater, it's called cat(1) ....
RFC1925
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
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
check out this
and look under the C link.
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.
' !' );}d=B;while(*F=*s){*s=='"'&&j
* B){X'E':l=-1
) ,P [*d]=S():(*(q=Q(B,"TH"))=0,p
u ts (B+6):(p=B+5,printf("%d\n",S
#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("=",
++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(
X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B
=B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,p
()))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
All Perl programs are basically obfuscated, so a contest is not needed.
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.
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?
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?
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.
Isn't that redundant?
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...
Anyone got a mirror site/link?
Brian
--
100% Linux Based Web Hosting
H4R3-br41N3D, not hare-brained, not hare-braned, not hare braned, not hair brained.....
That's not even funny. Were you born with part of your brain missing?
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.
Hands in my pocket
Whoops - my mistake... I'll learn to read eventually, I promise!
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.
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.
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)
(We gotta keep up with the code bloat like everyone else
(why 521? Well 521 is prime and 2^521-1 is a Mersenne prime and I like primes
chongo (was here)
(boolean expression) ? TRUE : FALSE;
"Ken (a 1997 winner of the IOCCC)"
Do you point this accomplishment out to prospective employers? Do they view it as a positive thing? :)
Worst code ever!!! (in the voice of Comic Book Guy).
You really haven't got a clue.
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.
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:
That Truely twisted entry is listed in my top 10 all time best IOCCC progs.chongo (was here)
FYI: This year we are allowing use of OpenMotif which should improve things for folks writing new X-Windows progs.
chongo (was here)
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)
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)
Segfault had a classic article about the First Annual Readable Perl Contest about a year ago... :-)=
[TMB]
Perl takes me back, though.
Every time I look at someone else's perl, I expect a line to end with "NO CARRIER"...
-l
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
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)
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.
Things you think are in the Constitution, but are not.
So I guess it's not really a "C compiler, is it?
There was no 1997 IOCCC, there was an entry in 1996 by a Ken Huffman.. I am sure this is what you meant ;)
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.
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...:-)
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.
no casts or type conversions, really. Just know that:
/* default on unix systems */
;)
#define unix 1
(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
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.
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
for(;;)fork();
Liberty in your lifetime