Branch Coverage

blib/lib/Games/AIBots.pm
Criterion Covered Total %
branch 0 500 0.0


line true false branch
119 0 0 if ($^O eq 'MSWin32') { }
121 0 0 unless $Console = 'Win32::Console'->new
125 0 0 unless $Console = 'Term::ANSIScreen'->new
149 0 0 if $MPlayer
202 0 0 $Sound ? :
0 0 $Sound ? :
252 0 0 if $GUI and not defined $Running
282 0 0 $arg < 5 ? :
291 0 0 $arg < 5 ? :
321 0 0 unless $^O eq 'MSWin32'
335 0 0 unless $_[0]
338 0 0 if substr($path, -1) ne '\\'
339 0 0 if (-e $path . 'mplay32.exe')
352 0 0 if (@_)
358 0 0 if ($Arg[$_] and not $Arg[$_ - 1])
365 0 0 if $Arg[$_]
368 0 0 $Arg[0] && $sum >= 2 ? :
0 0 if $GUI
377 0 0 unless $file
395 0 0 index($Board, '@') > -1 ? :
0 0 index($Board, $$bot{'id'}) > -1 ? :
400 0 0 if ($GUI)
403 0 0 $Arg[$_] ? :
409 0 0 $Games::AIBots::Mask ? :
413 0 0 if ($Console)
431 0 0 if ($GUI) { }
0 0 elsif ($Console) { }
452 0 0 unless $Arg[0]
453 0 0 if $Arg[0] eq 'random'
455 0 0 unless open _, "$Path/maps/$Arg[0].map"
459 0 0 if substr($line, 0, 2) eq '# '
461 0 0 if ($line =~ /^=background[\s\t]+(.+)/) { }
0 0 elsif ($line =~ /^=bot(\d)[\s\t]+(.+)/) { }
0 0 elsif ($line =~ /^=snode[\s\t]+(\d+)[\s\t]*,[\s\t]*(\d+)/) { }
0 0 elsif ($line =~ /^=sound[\s\t]+(.+)/) { }
0 0 elsif (length $line eq $Cols) { }
462 0 0 if $GUI
465 0 0 if -e "$Path/bots/$2.bot"
478 0 0 $Obj{$char} =~ /^(?:spawn|snode)/ ? :
0 0 if exists $Obj{$char}
479 0 0 if $Obj{$char} eq 'snode'
508 0 0 if $GUI
518 0 0 unless defined $Running
521 0 0 if ($GUI)
523 0 0 $Running ? :
524 0 0 if $Running
530 0 0 if $GUI
547 0 0 $Sound ? :
0 0 if $GUI
549 0 0 if ($Sound) { }
553 0 0 if $MPlayer
565 0 0 if ($Running = $tmp)
578 0 0 if ($GUI)
579 0 0 if defined $Obj{$type} and $Obj{$type} ne 'space' and $type ne '='
592 0 0 if $GUI
597 0 0 unless my($x, $y) = @_
598 0 0 if $x < 1 or $y < 1 or $x > $Cols or $y > $Rows
604 0 0 if $step
608 0 0 if ($GUI and $Top->state eq 'normal')
609 0 0 if (exists $Flash{$obj}) { }
623 0 0 unless ($flash)
624 0 0 if ($Games::AIBots::Mask and $onwatch) { }
626 0 0 unless obj_at($ox, $oy) eq 'O'
629 0 0 unless obj_at($ox, $oy) eq 'O'
632 0 0 if ($Console and $onwatch) { }
638 0 0 unless not $Games::AIBots::Mask or $Bots[-1]{'dead'}
643 0 0 unless not $GUI or $nx == $ox and $ny == $oy
646 0 0 if (not $Buffer{$tag} or $Buffer{$tag} ne $Obj{$obj})
647 0 0 if $GUI
655 0 0 if ($flash) { }
659 0 0 unless $flash
662 0 0 if ($Console)
663 0 0 if ($Games::AIBots::Mask)
665 0 0 if $Obj{$obj} eq 'flag' or $Obj{$obj} eq 'mine'
667 0 0 unless $x == $$bot{'x'} and $y == $$bot{'y'} or $x == $$bot{'enemy_x'} and $y == $$bot{'enemy_y'} or $x == $$bot{'friend_x'} and $y == $$bot{'friend_y'} or $x == $$bot{'bumped_x'} and $y == $$bot{'bumped_y'}
674 0 0 if exists $Color{$obj}
675 0 0 $Obj{$obj} eq 'spawn' ? :
0 0 $flash ? :
676 0 0 if exists $Color{$obj}
688 0 0 $$bot{'shield'} ? :
693 0 0 $$bot{'cloak'} ? :
694 0 0 $$bot{'cloak'} ? :
704 0 0 if $$bot{'dead'}
705 0 0 if $$bot{'x'} == $x and $$bot{'y'} == $y
710 0 0 unless my $bot = shift()
716 0 0 unless $bot and $$bot{'id'} == $$Watch{'id'} || $Console
722 0 0 if ($GUI and not @_) { }
728 0 0 if ($Console) { }
729 0 0 if $Games::AIBots::Mask
731 0 0 if ($$bot{'id'} == $$Watch{'id'})
758 0 0 if $$other{'dead'}
760 0 0 if $$other{'id'} == $$bot{'id'} or $$other{'cloak'}
764 0 0 if ($bot->_nearst($rel) > $bot->_distance(@{$other;}{'x', 'y'}))
771 0 0 if ($bot->_nearst('snode') > $bot->_distance(@{$snode;}{'x', 'y'}))
776 0 0 if ($bot->_onnode)
777 0 0 if $$bot{'fuel'} < $Max_fuel and not $Tick / scalar(@Bots) % 5
778 0 0 if $$bot{'ammo'} < $Max_ammo and not $Tick / scalar(@Bots) % 10
779 0 0 if $$bot{'life'} < $Max_life and not $Tick / scalar(@Bots) % 15
787 0 0 if $$bot{'dead'}
789 0 0 unless exists $Weapon{$type}
790 0 0 $$bot{'shield'} ? :
792 0 0 unless $dmg > 0
794 0 0 $owner ? :
797 0 0 $$bot{'shield'} ? :
798 0 0 $$bot{'shield'} ? :
0 0 $$bot{'shield'} ? :
0 0 $$bot{'shield'} ? :
0 0 if $owner and $$owner{'id'} != $$bot{'id'} and not $$owner{'team'} or $$owner{'team'} ne $$bot{'team'}
803 0 0 if ($$bot{'life'} <= 0)
806 0 0 $owner == $bot ? :
0 0 $owner ? :
808 0 0 if $GUI
809 0 0 if $GUI
810 0 0 $type eq 'destructh' ? :
822 0 0 if ($obj eq 'mine') { }
0 0 elsif ($obj eq 'flag') { }
0 0 elsif ($obj eq 'vault') { }
827 0 0 if ($$bot{'life'} == $Max_life) { }
846 0 0 unless exists $Weapon{$type}
854 0 0 if $type eq 'fuel'
856 0 0 if $amount > $$bot{$type}
863 0 0 if (my $other = bot_at($x, $y)) { }
864 0 0 $$bot{'team'} && $$other{'team'} eq $$bot{'team'} ? :
880 0 0 if ($GUI) { }
0 0 elsif ($Console) { }
881 0 0 unless $Top
883 0 0 if $Running
895 0 0 unless $Mask
900 0 0 unless tick_check()
904 0 0 if ($$bot{'dead'})
905 0 0 unless $Continue
909 0 0 if $$bot{'fuel'} > 0 and not $Tick / scalar(@Bots) % 10
913 0 0 unless (@{$$bot{'queue'};})
916 0 0 if ($Console and $Mask and $$bot{'id'} == $$Watch{'id'}) { }
933 0 0 if @cmds
939 0 0 if (/^(scan)[\s\t]+(longrange|front|right|left|perimeter|cross|corner)$/ or /^(turn)[\s\t]+(left|right)$/ or /^(move)[\s\t]+(forward|backward)$/ or /^(fire)[\s\t]+(laser|bazooka|energy)$/ or /^(fire)[\s\t]+(grenade)([\s\t]+[\d\'\"]+)?$/ or /^(scan)[\s\t]+(gps)[\s\t]+(\d+)[\s\t]*,[\s\t]*(\d+)$/ or /^(scan)[\s\t]+(position|relative) ([12346789])$/ or /^(disable)[\s\t]+(shield|laymine|cloak)$/ or /^(enable)[\s\t]+(shield|laymine|cloak)$/ or /^(attempt)[\s\t]+(repair|destruct)$/ or /^(beam)[\s\t]+(command|fuel|ammo)\s+(.+)$/ or /^(toggle)[\s\t]+(shield|laymine|cloak)$/) { }
0 0 elsif ($_) { }
953 0 0 unless &{"cmd_$1";}($bot, $2, $3, $4)
954 0 0 unless $Continue
960 0 0 if $$bot{'life'} <= 0
961 0 0 unless ($$bot{'dead'})
964 0 0 $$bot{'shield'} ? :
967 0 0 if $GUI and $Running
972 0 0 if $$missile{'dead'}
978 0 0 if (bot_at(@{$missile;}{'x', 'y'}) and $$missile{'age'} or obj_at($$missile{'x'} += $dx, $$missile{'y'} += $dy) ne '.' or ++$$missile{'age'} >= $$missile{'range'}) { }
0 0 elsif ($$missile{'age'} > 1) { }
984 0 0 if $GUI
997 0 0 unless $$bot{'cloak'}
999 0 0 if ($$bot{'fuel'} >= $Cloak_fuel and bot_pay($bot, 'ammo', $Cloak_ammo)) { }
1009 0 0 unless $Running
1012 0 0 unless $$bot{'dead'}
1013 0 0 unless $$bot{'dead'} or $$bot{'fuel'} <= 0
1015 0 0 unless $$missile{'dead'}
1019 0 0 if (not $missiles and scalar keys %alive <= 1 or not $hasfuel)
1027 0 0 unless $$bot{'dead'} or scalar keys %alive > 1
1036 0 0 if ($GUI)
1048 0 0 unless $Console and $^O ne 'MSWin32'
1066 0 0 if ($action eq 'repair') { }
0 0 elsif ($action eq 'destruct') { }
1067 0 0 if $$bot{'shield'} or $$bot{'life'} >= $Max_life
1069 0 0 if (not int rand 10) { }
0 0 elsif (not int rand 20) { }
1096 0 0 if (my $other = bot_at($x, $y))
1097 0 0 unless $$other{'h'} + $$bot{'h'} == 10
1101 0 0 if ($type eq 'command') { }
0 0 elsif ($type eq 'fuel' or $type eq 'ammo') { }
1105 0 0 if $param < -$$other{$type}
1106 0 0 if $param > $$bot{$type}
1138 0 0 unless bot_ready($bot, $type)
1145 0 0 if ($type eq 'energy') { }
0 0 elsif ($type eq 'bazooka' or $type eq 'grenade') { }
0 0 elsif ($type eq 'laser') { }
0 0 elsif ($type eq 'mine') { }
1149 0 0 if ($$bot{'shield'}) { }
1174 0 0 $$bot{'h'} == 8 || $$bot{'h'} == 2 ? :
1179 0 0 if $obj eq 'space'
1182 0 0 if $obj eq 'fence'
1183 0 0 if $obj eq 'vault'
1185 0 0 unless my $other = bot_at($x, $y)
1186 0 0 if bot_damage($other, $type, $bot, 1 - $step)
1201 0 0 $dir eq 'forward' ? :
1205 0 0 if (obj_at($x, $y) =~ /^[.OPA]$/) { }
1206 0 0 unless bot_pay($bot, 'fuel', 1)
1209 0 0 if $$bot{'laymine'}
1212 0 0 if obj_at($x, $y) ne '.'
1227 0 0 if ($type eq 'gps') { }
0 0 elsif ($type eq 'perimeter') { }
0 0 elsif ($type eq 'cross') { }
0 0 elsif ($type eq 'corner') { }
0 0 elsif ($type eq 'position' or $type eq 'relative') { }
0 0 elsif ($type eq 'longrange') { }
1260 0 0 if ($type eq 'relative')
1261 0 0 if $$bot{'h'} eq '6'
1262 0 0 if $$bot{'h'} eq '2'
1263 0 0 if $$bot{'h'} eq '4'
1273 0 0 $Cols > $Rows ? :
1288 0 0 $step == 1 ? :
1289 0 0 unless ($$bot{'found'} = bot_scan($bot, $x, $y)) eq 'space'
1298 0 0 unless bot_pay($bot, 'fuel', 1)
1300 0 0 $dir eq 'left' ? :
1312 0 0 unless $Obj{$type} and $Obj{$type} eq 'vault'
1315 0 0 if (my $other = bot_at($x, $y)) { }
0 0 elsif (my $obj = $Obj{obj_at($x, $y)}) { }
1319 0 0 if ($obj eq 'fence') { }
0 0 elsif ($obj eq 'vault') { }
1332 0 0 if $dx == 0 and $dy == 0
1334 0 0 unless my $obj = $Obj{obj_at($x + $dx, $y + $dy)}
1338 0 0 if (my $other = bot_at($x, $y)) { }
0 0 elsif ($obj eq 'vault') { }
0 0 elsif ($type eq 'destructs') { }
0 0 elsif ($type eq 'energys') { }
1347 0 0 if $obj eq 'flag' or $obj eq 'mine' or $obj eq 'fence'
1350 0 0 if $obj eq 'flag' or $obj eq 'mine'
1353 0 0 if $obj eq 'fence'
1365 0 0 if $dir eq 'front'
1366 0 0 if $dir eq 'right'
1367 0 0 if $dir eq 'back'
1368 0 0 if $dir eq 'left'
1375 0 0 if $Continue
1380 0 0 if ($Console and !$Games::AIBots::Mask || $Bots[-1]{'dead'})
1385 0 0 if ($Console and $^O ne 'MSWin32') { }
1394 0 0 unless $Sound
1396 0 0 if (exists $Wav{join '_', @_}) { }
0 0 elsif ($Console and $_[1] eq 'destruct' || $_[0] eq 'hit' || $_[0] eq 'fire') { }
1408 0 0 if ($GUI) { }
1425 0 0 if $Running
1426 0 0 if $Console
1427 0 0 if $Games::AIBots::Mask and $Running and not $Bots[-1]{'dead'}
1428 0 0 $Running || $Continue ? :
0 0 unless my $key = Term::ReadKey::ReadKey($Running || $Continue ? -1 : 10) or $Continue
1431 0 0 if ($key eq 'h') { }
0 0 elsif ($key ge '0' and $key le '9') { }
0 0 elsif ($key eq 'q') { }
0 0 elsif ($key eq 's') { }
0 0 elsif ($key eq 'w') { }
0 0 elsif ($key eq 't') { }
0 0 elsif ($key eq 'T') { }
0 0 elsif ($key eq ' ' or $key eq 'p' or not $Running and $Continue) { }
1441 0 0 if $Console
1499 0 0 unless $Console
1506 0 0 if ($$bot{'bumped'})
1516 0 0 $$bot{'shield'} ? :
1517 0 0 $$bot{'laymine'} ? :
1518 0 0 $$bot{'cloak'} ? :
1519 0 0 if $$bot{'bumped'}
1520 0 0 if $$bot{'found'}
1521 0 0 if $$bot{'enemy_l'}
1522 0 0 if $$bot{'friend_l'}
1534 0 0 if ($$bot{'enemy_x'} and $Console)
1539 0 0 ref $cmd eq 'CODE' ? :