Beginning with an end
The last day of September was also my last day at Orange, after 5 years and 9 months working there as a sysadmin/sysdev. Because I was "the Perl guy" other there, my last message couldn't be a standard "it's been a pleasure working with you blah blah". Obviously, I had to send a Perl obfuscation.
Unfortunately, I didn't have the time to work more than one or two hours on it, so I ended with something simple:
use 5.010;$:=v117.116.102.56;eval"use encoding $:=>STDOUT=>'$:'";$c=
1e4;$i=-1;$b=0x3041;@f=(20,71,41,72);while($i<4){@v=map+int rand(86)
,1..4;@v[0..$i]=@f[0..$i]if$i>0;$c--if$c&&$v[1+$i]%4==0;$c=+5e3,$i++
if$c==0&&$v[$i]==$f[$i];print+chr($b+$_)for@v;print"\r"}print"\n\x4"
(I know, it barely deserve the title "obfuscation", but I don't have BooK's or cognominal's experience in this domain. At least, it's correctly justified.)
The aim of this code is to print, in a funny way, 5 important characters. The first 4 are the Japanese characters さよなら (sayonara). The last character is ASCII 0x04, EOT (End of Transmission). I'll assume I need not explain the meaning and references.
Now, if I began writing about this code, it's to explain the mistake I did in it. Can you see it?
It's not very apparent because the code basically works. In fact, it works faster than I expected. This is the problem. On my PowerBook G4, it takes a bit more than 5 sec to execute. On a more recent computer, usually less than a second.
The reason? I stupidly used loops to simulate sleeps. This is surely lesson one when making a demo or a game: fix your timestep so the program performs consistently on different platforms. That's not something we're used to think of in sysdev, but that's the basis when making a game.
That's pretty cool even if it is too fast :)