From 452c4a07447644fbc2c19b1e7cff3e8372721f53 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 9 Dec 2011 14:52:28 +0100 Subject: [PATCH] Example client: Try fixing erratic movement --- client/example.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/example.pl b/client/example.pl index e4abe45..5d9bae6 100755 --- a/client/example.pl +++ b/client/example.pl @@ -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], ); - my $max = $dirs[1]; + my $max = $dirs[0]; # Default direction in case of nothing interesting in the vicinity # 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)]) { print $socket "attack_dir $max->[0] $max->[1]\r\n";