mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 09:53:38 +02:00
Example client: Try fixing erratic movement
This commit is contained in:
parent
23f2fce7ff
commit
452c4a0744
1 changed files with 2 additions and 2 deletions
|
@ -80,7 +80,7 @@ sub take_action($%) {
|
||||||
[0, -2], [1, -2], [2, -2], [2, -1], [2, 0], [2, 1], [2, 2], [1, 2], [0, 2], [-1, 2], [-2, 2], [-2, 1], [-2, 0], [-2, -1], [-2, -2], [-1, -2],
|
[0, -2], [1, -2], [2, -2], [2, -1], [2, 0], [2, 1], [2, 2], [1, 2], [0, 2], [-1, 2], [-2, 2], [-2, 1], [-2, 0], [-2, -1], [-2, -2], [-1, -2],
|
||||||
);
|
);
|
||||||
|
|
||||||
my $max = $dirs[1];
|
my $max = $dirs[0];
|
||||||
# Default direction in case of nothing interesting in the vicinity
|
# Default direction in case of nothing interesting in the vicinity
|
||||||
# is [1, -1].
|
# is [1, -1].
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ sub take_action($%) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "moves ".join(", ", @move)." => ($max->[0],$max->[1])\n";
|
print "moves ".join(", ", @move)." => (".dirindex($max).":$max->[0],$max->[1])\n";
|
||||||
|
|
||||||
if ($attack[dirindex($max)]) {
|
if ($attack[dirindex($max)]) {
|
||||||
print $socket "attack_dir $max->[0] $max->[1]\r\n";
|
print $socket "attack_dir $max->[0] $max->[1]\r\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue