Controls reminder:
Movement commands:
qwe
a d
zxc
Magic:
m
const 50 mana, kills all enemies around you (do not heal from this
kills).
Score when you win is number of kills/total number of turns.
Actually it is more of a challenge to win with least kills possible :)
packed code(should be onlined):
sub l:lvalue{$l[$_[0]][$_[1]]}sub r{int(rand($_[0]))}sub p{print@_}$h=
$m=100;$|=$x=$y=$d=1;p"Name:";chomp($n=<>);@a=-1..1;≫do{system
clear;p@$_,$/for@l;p"H$h M$m D$d\n>";$_=<>;$o=/[edc]/-/[qaz]/;$g=/
[zxc]/-/[qwe]/;if(/m/&&$m>=50){$m-=50;for$r(@a){for(@a){$f=\l($y+$r,$x+
$_);$$f eq'e'?$$f='.':0}}}l($y,$x)='.';$_=l($y+$g,$x+$o);if(/e/){$k++;
$h++;$_='.'}if(/\./){$x+=$o;$y+=$g}if(/>/){≫$d++;$x=$y=1}l($y,
$x)='@';for(@e){$p=$_->{y};$q=@$_{x};$f=\l($p,$q);if($$f ne'e'||@$_{d})
{@$_{d}=1;next}$$f='.';$g=r(3)-1;$o=r(3)-1;$g=($q<$x)-($q>$x),$o=($p<
$y)-($p>$y)if r(100)<$u/2;for$r(@a){for(@a){if(l($p+$r,$q+$_)eq'@'){$g=
$_;$o=$r}}}$s=\l($p+$o,$q+$g);$h-=r(10+$d)+5if$$s=~/@/;if($$s eq'.'){@
$_{x}+=$g;@$_{y}+=$o;$$s='e'}else{$$f='e'}}$t++;$u++;$m+=
$m<100}while($h>0&&$d<=10);$h>0?p"$n wins. Score $k/$t.\n":p"$n died.
\n";sub gg{for$r(0..19){l($r,$_)=$r&&$_&&$r<19&&
$_<19&&r(100)>20?'.':'#'for(0..19);}for(0..20+$d*5){$a=1+r(18);
$b=1+r(18);$e[$_]={x=>$a,y=>$b};l($b,$a)='e'}
$u=l(1,1)='@';l(2,2)=l(18,18)='.';l(19,19)='>'}
code readable (there is comment line with colored output):
sub l:lvalue{$l[$_[0]][$_[1]]}
sub r{int(rand($_[0]))}
sub p{print@_}
$h=$m=100;
$|=$x=$y=$d=1;
p"Name:";
chomp($n=<>);
@a=-1..1;
≫
do{
system clear;
# p map{$_ eq'e'?"\033[01;31me\033[00m":$_}@$_,$/for@l;
p@$_,$/for@l;
p"H$h M$m D$d\n>";
$_=<>;
$o=/[edc]/-/[qaz]/;$g=/[zxc]/-/[qwe]/;
if(/m/&&$m>=50)
{
$m-=50;
for$r(@a)
{
for(@a)
{
$f=\l($y+$r,$x+$_);
$$f eq'e'?$$f='.':0
}
}
}
l($y,$x)='.';
$_=l($y+$g,$x+$o);
if(/e/)
{
$k++;$h++;
$_='.'
}
if(/\./)
{
$x+=$o;
$y+=$g
}
if(/>/)
{
≫
$d++;
$x=$y=1
}
l($y,$x)='@';
for(@e)
{
$p=$_->{y};$q=@$_{x};
$f=\l($p,$q);
if($$f ne'e'||@$_{d})
{
@$_{d}=1;
next
}
$$f='.';
$g=r(3)-1;
$o=r(3)-1;
$g=($q<$x)-($q>$x),$o=($p<$y)-($p>$y)if r(100)<$u/2;
for$r(@a)
{
for(@a)
{
if(l($p+$r,$q+$_)eq'@')
{
$g=$_;
$o=$r
}
}
}
$s=\l($p+$o,$q+$g);
$h-=r(10+$d)+5if$$s=~/@/;
if($$s eq'.')
{
@$_{x}+=$g;
@$_{y}+=$o;
$$s='e'
}else
{
$$f='e'
}
}
$t++;$u++;
$m+=$m<100
}while($h>0&&$d<=10);
$h>0?p"$n wins. Score $k/$t.\n":p"$n died.\n";
sub gg
{
for$r(0..19)
{
l($r,$_)=$r&&$_&&$r<19&&$_<19&&r(100)>20?'.':'#'for(0..19);
}
for(0..20+$d*5)
{
$a=1+r(18);
$b=1+r(18);
$e[$_]={x=>$a,y=>$b};l($b,$a)='e'
}
$u=l(1,1)='@';
l(2,2)=l(18,18)='.';
l(19,19)='>'
}
Can you add an executable, so I add it to the site, or should I just
upload the source?