#!/usr/bin/perl
use strict;
use Term::ReadKey;
ReadMode 'cbreak';
# init some stuff
$,=$/;
$/=++$b+$b;
$=='8';
$b=$=x28;
$*=$=x2;
@!=(qw(4 _ " a 1 1 0 0 ));
$![7]=`clear`;
# prepare an important string...
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$=p8$=q8q$=8p(#.{59})$=8$=$1q8#q(.{60})$=8#$=$1
pap(.{60})!8$![0]++;"\*$1$="8q(.{60})!8$![0]++;
"\*$1$="8(t.*)!8$b=(length$1)-61;
substr($1,0,$b )."!". substr($1,$b+1).$=4x"gs'"x"c"es'"c"z"gs if'
.shift"z"l"just another perl hacker"l4'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);
# generate board and regex subs
j(split shift@!,pop@!);
a(split shift@!,pop@!);
push(@!,split shift@!,pop@!);
$_=$a;
map{s/\n//g}@!;
map{s/ //g}@!;
# start main loop
&p;
# subs
sub END{
ReadMode 'normal'
}
# init board
sub j {
$_=shift;
$a.=m/^1/?("#$b$=$=$b#$,"x12):"#".eval( )."#$,";
@_&&j(@_)
}
# generate routines
sub a {
eval"sub'".pop().'{eval\'s/\'.(shift).\'/\'.(shift).\'/'.pop().';@_&&'.pop().'(@_)}';
@_&&a(@_)
}
# main loop
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
}
# print end message
sub h {
print $![3],shift,"You killed $![0] space invaders",$,;
exit
}
####
#!/usr/bin/perl
use strict;
use Term::ReadKey;
ReadMode 'cbreak';
####
# init some stuff
$,=$/;
$/=++$b+$b;
$=='8';
$b=$=x28;
$*=$=x2;
@!=(qw(4 _ " a 1 1 0 0 ));
$![7]=`clear`;
####
# prepare an important string...
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$=p8$=q8q$=8p(#.{59})$=8$=$1q8#q(.{60})$=8#$=$1
pap(.{60})!8$![0]++;"\*$1$="8q(.{60})!8$![0]++;
"\*$1$="8(t.*)!8$b=(length$1)-61;
substr($1,0,$b )."!". substr($1,$b+1).$=4x"gs'"x"c"es'"c"z"gs if'
.shift"z"l"just another perl hacker"l4'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);
####
push(@! split(4,"$=W...58"));
####
$=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$=p8$=q8q$=8p(#.{59})$=8$=$1q8#q(.{60})$=8#$=$1pap(.{60})!8$![0]++;"\*$1$="8q(.{60})!8$![0]++;"\*$1$="8(t.*)!8$b=(length$1)-61;substr($1,0,$b )."!". substr($1,$b+1).$=
x"gs'"x"c"es'"c"z"gs if'.shift"z"l"just another perl hacker"l
'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 58
####
# generate board and regex subs
j(split shift@!,pop@!);
a(split shift@!,pop@!);
push(@!,split shift@!,pop@!);
$_=$a;
map{s/\n//g}@!;
map{s/ //g}@!;
# start main loop
&p;
####
(
'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 58,
)
####
(
'SpaceInvaders'.('8'x12).'domm@zsi.at j=left k=fire l=right',
'#'x58,
("88p88"x11).'8'x3,
'88'.("8888q"x11).'8',
("p8888"x11).'8'x3
('8'x3).("8888q"x11),
1,
'88888888888888888888888888888'.'8'."W88888888888888888888888888888",
'#'x 58,
)
####
# init map
sub j {
$_=shift;
$a.=m/^1/?("#$b$=$=$b#$,"x12):"#".eval( )."#$,";
@_&&j(@_)
}
####
(x, gs', x, c, es', c, z, gs if'.shift, z, l , just another perl hacker ,l)
####
sub a {
eval"sub'".pop().'{eval\'s/\'.(shift).\'/\'.(shift).\'/'.pop().';@_&&'.pop().'(@_)}';
@_&&a(@_)
}
####
(
$=W8W$=8$b eq "j"8W$=8$=W8 $b eq"l"8W$=8W!8($b eq"k"&&$_!~/!/)
#W$=8#$=W8$=W#8W$=#8#!8##
\*8$=8p$=8$=p8$=q8q$=8p(#.{59})$=8$=$1q8#q(.{60})$=8#$=$1p
p(.{60})!8$![0]++;"\*$1$="8q(.{60})!8$![0]++;"\*$1$="8(t.*)!8$b=(length$1)-61;substr($1,0,$b )."!". substr($1,$b+1).$=
)
####
$_=$a;
map{s/\n//g}@!;
map{s/ //g}@!;
####
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
}
####
$![1]x. x is one of the autogenerated subs that does some substitution on $_. It substitutes the first value passed to it with the second, until there are no values left.
What gets passed to x is $![6]
####
\* $=
p$= $=p
$=q q$=
p(#.{59})$= $=$1q
q(.{60})$= #$=$1p
####
z(split$=,$![4]);
x(split$=,$![5]);
c(split$=,$![7]);
####
sub h {
print $![3],shift,"You killed $![0] space invaders",$,;
exit
}
####
sub END{
ReadMode 'normal'
}