An old classic, ideal to waste some time with (either playing or deobfuscating ...)
#!/usr/bin/perl
use strict;
use Term'ReadKey;ReadMode
'cbreak';$,=$/;$/=++$b+$b;$=='8';$b=$=
x28;$*=$=x2;@!=(qw(4 _ " a 1 1 0 0 ));$![7]=`clear`
;push(@!,split shift(@!),q 7$=W8W$=8$b eq "j"8W$=8$=W8 $b eq
"l"8W$=8W!8($b eq"k"&&$_!~/!/)a#W$=8#$=W8$=W#8W$=#8#!8##a\*8
$=8p$=8$=p 8$=q8q$=8p(#.{59})$=8$=$ 1q8#q(.{60
})$=8#$=$1 pap(.{60})!8$![0]++;"\*$ 1$="8q(.{6
0})!8$![0] ++;"\*$1$="8(t.*)!8$b=(l ength$1)-6
1;substr($ 1,0,$b )."!". substr($1, $b+1).$=4x
"gs'"x"c"es'"c"z"gs if'.shift"z"l"just another perl hacker"l
4'SpaceInvaders'.($=x12).'domm@zsi.at j=left k=fire l=right'
_'#'x58_("$*p$*"x11).$=x3_$*.("$*$*q"x11).$=_("p$*$*"x11).$=
x3_($=x3).("$*$*q"x11)_1_$b.$=."W$b"_'#'x 587);j(split shift
@!,pop@!);a(split shift@!,pop@!);push(@!,split shift@!,pop@!
);$_=$a;map{s/\n//g}@!;map{s/v//g}@!;map{s/ //g}@!;&p;sub'j
{$_=shift;$a.=m/^1/?("#$b$=$=$b#$,"x12):"#".eval( )."#$,";@_
&&j(@_)}sub'END{ReadMode 'normal' }sub'a{eval"sub'".pop().'{
eval\'s/\'.(shift).\'/\'.(shift).\'/'.pop().';@_&&'.pop().'(
@_)}';@_&&a(@_)}sub'p{$b=ReadKey -1;$![1]%3==0&&x(split$=,$!
[6]);z(split$=,$![4]);x(split$=,$![5]);c(split$=,$![7]);$![1
]++;select+(@-,@-,@-,0.05);($![2]=$_)=~s/$=/ /g;/pW|Wq/&&h('
Game over');$_!~/p|q/&&h('You saved our planet. Yeah');print
$![3],$![2 ];&p}sub h{print $![ 3],shift,"
You killed $![0] space invaders ",$,;exit}
Notes
- If you have problems with copy&pasting the code, download it from here
- Term::ReadKey is required, as I was to lazy to implement its functionality myself
- There might be some problems with the refresh rate, depending on your hard/software. You could try different values, shouldn't be too hard to find in the code.
- There are no IFs, WHILEs or FORs - as thedamian once said, control structures are for whimps!
- In fact, most of the functions used are array manipulating stuff and regexes (and one or two (three, in fact) evals, of course)
I'll post a solution later this week...
UPDATE: Here is the solution.
--
#!/usr/bin/perl -w just another perl hacker
print+seek(DATA,$=*.3,@-)?~~<DATA>:$:__DATA__