Branch Coverage

blib/lib/Game/TextMapper/Schroeder/Alpine.pm
Criterion Covered Total %
branch 222 280 79.2


line true false branch
97 1 28 if $altitude->{$coordinates}
102 28 0 if ($r < $distribution[$i])
124 0 1196 unless $current_altitude > 0
128 0 1196 if rand() < $n - int($n)
130 0 1196 if $n < 1
136 1605 15760 unless $self->legal($x, $y)
139 15262 498 if ($altitude->{$other})
141 2072 13190 unless $self->legal($x, $y)
145 12520 670 if ($altitude->{$other})
146 3771 8749 if $attempt > 4
151 1168 0 $current_altitude > 0 ? :
165 0 1200 unless (defined $altitude->{$coordinates})
170 0 0 unless $self->legal($x, $y)
172 0 0 unless defined $altitude->{$other}
177 0 0 unless (defined $altitude->{$coordinates})
206 2 56 if $current_altitude > 10 or $current_altitude < 0
212 56 0 if ($delta < -1 or $delta > 1)
216 28 252 unless $self->legal($x, $y)
219 1 251 if $current_altitude > 10 or $current_altitude < 0
238 0 1200 if $altitude->{$coordinates} <= $self->bottom
247 1584 4416 if $legal and $altitude->{$other} > $altitude->{$coordinates}
249 208 3732 if $legal and $water->{$other} and $water->{$other} == ($i - 3) % 6
257 3604 4002 unless defined $water->{$next}
261 461 3541 unless $self->legal($x, $y)
265 143 3398 if $loop{$next}
268 397 2507 if (not defined $direction or not $legal and $altitude->{$coordinates} < $lowest or $legal and $altitude->{$other} < $lowest)
271 1423 135 $legal ? :
276 1161 39 if (defined $direction)
279 1161 0 unless $world->{$coordinates} =~ s/arrow\d/arrow$water->{$coordinates}/u
289 35 1165 if ($altitude->{$coordinates} >= 10) { }
98 1067 elsif ($altitude->{$coordinates} >= 9) { }
248 819 elsif ($altitude->{$coordinates} >= 8) { }
303 0 1200 if ($altitude->{$coordinates} <= $self->bottom)
307 0 0 unless $self->legal($x, $y)
309 0 0 if $altitude->{$other} <= $self->bottom
312 0 0 $ocean ? :
322 39 1161 if (not defined $water->{$coordinates} and $world->{$coordinates} ne "ocean")
334 167 1033 if $world->{$coordinates} =~ /ocean|water|swamp|grass/u
336 610 423 unless $flow->{$coordinates}
338 57 366 if $dry->{$coordinates}
342 52 314 unless $self->legal($x, $y)
345 234 80 if $altitude->{$coordinates} > $altitude->{$other}
347 67 13 if ($altitude->{$coordinates} >= 6) { }
365 0 4 unless @lakes
381 0 408 unless $coordinates
384 376 32 if ($self->legal($coordinates) and $world->{$coordinates} ne "ocean")
389 472 1296 if $seen{$to}
402 135 84 if (not defined $water->{$from} or $water->{$from} != $i) { }
407 39 96 unless $world->{$from} =~ s/arrow\d/arrow$i/u
417 35 4 if $start
419 4 28 unless $start
429 105 141 unless $world->{$_} =~ /mountain|swamp|grass|water|ocean/u
437 669 0 if $altitude->{$_} == 7 || $altitude->{$_} == 8 || $world->{$_} =~ /water/u && $altitude->{$_} > $self->bottom and not $flow->{$_}
452 1240 216 if (defined $water->{$coordinates}) { }
454 0 1240 if grep /$other/u, @$river
456 30 1210 if (ref $flow->{$other}) { }
492 90 951 if ($seen{$coordinates})
496 3 87 if (@$canyon)
498 1 2 if ($other[0] eq $canyon->[-1]) { }
505 3 2 if $other ne $coordinates
518 73 878 if ($altitude->{$coordinates} and $current_altitude < $altitude->{$coordinates} and not $world->{$coordinates} =~ /water|ocean/u) { }
522 31 42 unless @$canyon
524 73 0 unless $dry->{$coordinates}
530 28 850 if (@$canyon)
553 0 0 if $flow->{$other}
558 0 0 if $flow->{$other}
566 90 355 unless $world->{$coordinates} =~ /mountain|hill|water|ocean|swamp|grass/u
569 0 445 if rand() < $self->arid - int($self->arid)
572 445 0 if ($n >= 1)
575 194 2032 unless $self->legal($x, $y)
577 121 1911 if $dry->{$other}
578 661 1250 if $altitude->{$coordinates} < $altitude->{$other}
579 444 806 unless $world->{$other} =~ /mountain|hill|water|ocean|swamp|grass/u
582 445 0 if ($n >= 2)
585 700 3752 unless $self->legal($x, $y)
587 2818 934 if $altitude->{$coordinates} <= $altitude->{$other}
591 160 2749 unless $self->legal($mx, $my)
593 170 2579 if $dry->{$midway}
594 1635 944 if $self->distance($midway, $other) != 1
595 65 879 if $altitude->{$coordinates} < $altitude->{$midway}
596 52 827 if $altitude->{$midway} < $altitude->{$other}
600 107 827 unless $ok
601 439 388 unless $world->{$other} =~ /mountain|hill|water|ocean|swamp|grass/u
606 250 723 if ($altitude->{$coordinates} >= 7) { }
504 219 elsif ($altitude->{$coordinates} >= 6) { }
219 0 elsif ($altitude->{$coordinates} >= 4) { }
623 73 445 if $dry->{$coordinates}
635 564 636 if $altitude->{$coordinates} < 7 or $altitude->{$coordinates} > 8
639 58 578 unless $self->legal($x, $y)
642 155 423 if $altitude->{$coordinates} > $altitude->{$other}
654 812 388 if $altitude->{$coordinates} != 7
656 4 384 if $world->{$coordinates} =~ /water|ocean/u
660 31 353 unless $self->legal($x, $y)
663 225 128 if $altitude->{$coordinates} > $altitude->{$other}
673 142 1058 unless ($world->{$coordinates} =~ /mountain|hill|water|ocean|swamp|grass|forest|firs|trees/u)
674 46 96 if ($altitude->{$coordinates} >= 7) { }
687 54 257 unless $self->legal($x, $y)
689 51 206 if $world->{$other} =~ /forest|firs|trees|swamp/u
691 42 3 if ($altitude->{$coordinates} >= 5) { }
3 0 elsif ($altitude->{$coordinates} >= 3) { }
702 11 85 if $self->with_river($rivers, $coordinates)
705 35 182 unless $self->legal($x, $y)
707 62 120 unless $world->{$other} =~ /grass|desert|water/u
709 23 0 if ($altitude->{$coordinates} >= 3) { }
720 11 4554 if grep {$coordinates eq $_;} @$river
732 4 4 if @candidates > $max / 10
736 25 105 unless $world->{$coordinates} =~ s/fir-forest/firs thorp/u
738 50 3550 if $world->{$_} =~ /(?
740 0 8 if @candidates > $max / 20
745 39 3561 if $world->{$_} =~ /(?
747 0 8 if @candidates > $max / 40
754 0 8 if @candidates > $max / 40
761 0 8 if @candidates > $max / 40
770 727 50 unless $world->{$other} and $world->{$other} =~ /water|ocean/u
781 2 174 if $world->{$coordinates} =~ /large-town|city/u
782 7 169 if $world->{$coordinates} =~ / town/u
797 176 6744 if $from eq $to
800 210 220 if ($distance <= 3 and !$best_distance || $distance <= $best_distance and !$best || $altitude->{$to} < $best_altitude)
808 7 169 unless $best
810 33 136 if $trails{"$best-$from"}
823 0 1200 if $altitude->{$coordinates} <= $self->bottom
826 476 5524 unless $self->legal($x, $y)
828 300 5224 if ($altitude->{$coordinates} - $altitude->{$other} >= 2)
829 202 98 if (@neighbors == 6) { }
845 152 583 if $seen{$coordinates}
847 64 519 unless exists $altitude->{$coordinates}
848 0 519 if ($altitude->{$coordinates} <= $self->bottom)
849 0 0 if ($altitude->{$coordinates} == $self->bottom and $world->{$coordinates} =~ /water|ocean/u and $altitude->{$coordinates} == $altitude->{$last} - 1) { }
866 4 0 unless $self->climate eq "desert"
868 0 0 if ($self->with_river($rivers, $coordinates)) { }
870 0 0 unless $world->{$coordinates} =~ s/light-grey/light-green/u
877 0 0 unless $world->{$coordinates} =~ s/light-green bushes/rock bushes/u or $world->{$coordinates} =~ s/light-grey grass/rock bush/u or $world->{$coordinates} =~ s/dark-grey grass/dark-soil bush/u or $world->{$coordinates} =~ s/^grey grass/rock bush/u or $altitude->{$coordinates} >= 4 and $world->{$coordinates} =~ s/light-grey desert/dark-soil desert/u
882 0 0 unless $world->{$coordinates} =~ s/dark-grey swamp2?/light-green bushes/u or $world->{$coordinates} =~ s/^grey swamp2?/light-grey bushes/u or $world->{$coordinates} =~ s/fir-forest/trees/u
922 0 76 if $step == $i++
932 44 32 if ($step >= 10)
958 0 4 shift() ? :
987 0 4 if ($step > 0)
1002 0 4 if ($step > 0)
1014 2 2 if $url
1016 2 2 if wantarray