Branch Coverage

blib/lib/Game/TextMapper/Schroeder/Alpine.pm
Criterion Covered Total %
branch 217 278 78.0


line true false branch
80 2 28 if $altitude->{$coordinates}
99 0 1200 unless $current_altitude > 0
103 0 1200 if rand() < $n - int($n)
105 0 1200 if $n < 1
111 1538 15833 unless $self->legal($x, $y)
114 15345 488 if ($altitude->{$other})
116 1986 13359 unless $self->legal($x, $y)
120 12675 684 if ($altitude->{$other})
121 3870 8805 if $attempt > 4
126 1172 0 $current_altitude > 0 ? :
140 0 1200 unless (defined $altitude->{$coordinates})
145 0 0 unless $self->legal($x, $y)
147 0 0 unless defined $altitude->{$other}
152 0 0 unless (defined $altitude->{$coordinates})
181 2 56 if $current_altitude > 10 or $current_altitude < 0
187 56 0 if ($delta < -1 or $delta > 1)
191 24 256 unless $self->legal($x, $y)
194 1 255 if $current_altitude > 10 or $current_altitude < 0
213 0 1200 if $altitude->{$coordinates} <= $self->bottom
222 1592 4408 if $legal and $altitude->{$other} > $altitude->{$coordinates}
224 273 3659 if $legal and $water->{$other} and $water->{$other} == ($i - 3) % 6
232 3534 3156 unless defined $water->{$next}
236 419 2737 unless $self->legal($x, $y)
240 182 2555 if $loop{$next}
243 416 2377 if (not defined $direction or not $legal and $altitude->{$coordinates} < $lowest or $legal and $altitude->{$other} < $lowest)
246 1429 147 $legal ? :
251 1160 40 if (defined $direction)
254 1160 0 unless $world->{$coordinates} =~ s/arrow\d/arrow$water->{$coordinates}/u
264 34 1166 if ($altitude->{$coordinates} >= 10) { }
96 1070 elsif ($altitude->{$coordinates} >= 9) { }
253 817 elsif ($altitude->{$coordinates} >= 8) { }
278 0 1200 if ($altitude->{$coordinates} <= $self->bottom)
282 0 0 unless $self->legal($x, $y)
284 0 0 if $altitude->{$other} <= $self->bottom
287 0 0 $ocean ? :
297 40 1160 if (not defined $water->{$coordinates} and $world->{$coordinates} ne "ocean")
309 202 998 if $world->{$coordinates} =~ /ocean|water|swamp|grass/u
311 538 460 unless $flow->{$coordinates}
313 46 414 if $dry->{$coordinates}
317 57 357 unless $self->legal($x, $y)
320 267 90 if $altitude->{$coordinates} > $altitude->{$other}
322 65 25 if ($altitude->{$coordinates} >= 6) { }
340 0 4 unless @lakes
356 0 448 unless $coordinates
359 413 35 if ($self->legal($coordinates) and $world->{$coordinates} ne "ocean")
364 489 1503 if $seen{$to}
377 168 109 if (not defined $water->{$from} or $water->{$from} != $i) { }
382 40 128 unless $world->{$from} =~ s/arrow\d/arrow$i/u
392 36 4 if $start
394 4 31 unless $start
404 102 151 unless $world->{$_} =~ /mountain|swamp|grass|water|ocean/u
412 708 0 if $altitude->{$_} == 7 || $altitude->{$_} == 8 || $world->{$_} =~ /water/u && $altitude->{$_} > $self->bottom and not $flow->{$_}
427 1424 224 if (defined $water->{$coordinates}) { }
429 0 1424 if grep /$other/u, @$river
431 29 1395 if (ref $flow->{$other}) { }
467 82 1096 if ($seen{$coordinates})
471 2 80 if (@$canyon)
473 2 0 if ($other[0] eq $canyon->[-1]) { }
480 0 0 if $other ne $coordinates
493 61 1035 if ($altitude->{$coordinates} and $current_altitude < $altitude->{$coordinates} and not $world->{$coordinates} =~ /water|ocean/u) { }
497 27 34 unless @$canyon
499 61 0 unless $dry->{$coordinates}
505 25 1010 if (@$canyon)
528 0 0 if $flow->{$other}
533 0 0 if $flow->{$other}
541 111 402 unless $world->{$coordinates} =~ /mountain|hill|water|ocean|swamp|grass/u
544 0 513 if rand() < $self->arid - int($self->arid)
547 513 0 if ($n >= 1)
550 202 2338 unless $self->legal($x, $y)
552 124 2214 if $dry->{$other}
553 755 1459 if $altitude->{$coordinates} < $altitude->{$other}
554 500 959 unless $world->{$other} =~ /mountain|hill|water|ocean|swamp|grass/u
557 513 0 if ($n >= 2)
560 712 4368 unless $self->legal($x, $y)
562 3267 1101 if $altitude->{$coordinates} <= $altitude->{$other}
566 104 3305 unless $self->legal($mx, $my)
568 209 3096 if $dry->{$midway}
569 1995 1101 if $self->distance($midway, $other) != 1
570 50 1051 if $altitude->{$coordinates} < $altitude->{$midway}
571 38 1013 if $altitude->{$midway} < $altitude->{$other}
575 88 1013 unless $ok
576 455 558 unless $world->{$other} =~ /mountain|hill|water|ocean|swamp|grass/u
581 315 751 if ($altitude->{$coordinates} >= 7) { }
457 294 elsif ($altitude->{$coordinates} >= 6) { }
288 6 elsif ($altitude->{$coordinates} >= 4) { }
598 61 513 if $dry->{$coordinates}
610 518 682 if $altitude->{$coordinates} < 7 or $altitude->{$coordinates} > 8
614 32 650 unless $self->legal($x, $y)
617 195 455 if $altitude->{$coordinates} > $altitude->{$other}
629 771 429 if $altitude->{$coordinates} != 7
631 14 415 if $world->{$coordinates} =~ /water|ocean/u
635 37 378 unless $self->legal($x, $y)
638 216 162 if $altitude->{$coordinates} > $altitude->{$other}
648 88 1112 unless ($world->{$coordinates} =~ /mountain|hill|water|ocean|swamp|grass|forest|firs|trees/u)
649 30 58 if ($altitude->{$coordinates} >= 7) { }
662 30 124 unless $self->legal($x, $y)
664 43 81 if $world->{$other} =~ /forest|firs|trees|swamp/u
666 15 0 if ($altitude->{$coordinates} >= 5) { }
0 0 elsif ($altitude->{$coordinates} >= 3) { }
677 8 50 if $self->with_river($rivers, $coordinates)
680 20 75 unless $self->legal($x, $y)
682 45 30 unless $world->{$other} =~ /grass|desert|water/u
684 5 0 if ($altitude->{$coordinates} >= 3) { }
695 8 2780 if grep {$coordinates eq $_;} @$river
707 4 4 if @candidates > $max / 10
711 34 92 unless $world->{$coordinates} =~ s/fir-forest/firs thorp/u
713 51 3549 if $world->{$_} =~ /(?
715 0 8 if @candidates > $max / 20
720 38 3562 if $world->{$_} =~ /(?
722 0 8 if @candidates > $max / 40
729 0 8 if @candidates > $max / 40
736 0 8 if @candidates > $max / 40
745 743 36 unless $world->{$other} and $world->{$other} =~ /water|ocean/u
756 2 171 if $world->{$coordinates} =~ /large-town|city/u
757 7 166 if $world->{$coordinates} =~ / town/u
772 173 6826 if $from eq $to
775 234 218 if ($distance <= 3 and !$best_distance || $distance <= $best_distance and !$best || $altitude->{$to} < $best_altitude)
783 11 162 unless $best
785 28 134 if $trails{"$best-$from"}
798 0 1200 if $altitude->{$coordinates} <= $self->bottom
801 476 5524 unless $self->legal($x, $y)
803 274 5250 if ($altitude->{$coordinates} - $altitude->{$other} >= 2)
804 163 111 if (@neighbors == 6) { }
820 160 638 if $seen{$coordinates}
822 64 574 unless exists $altitude->{$coordinates}
823 0 574 if ($altitude->{$coordinates} <= $self->bottom)
824 0 0 if ($altitude->{$coordinates} == $self->bottom and $world->{$coordinates} =~ /water|ocean/u and $altitude->{$coordinates} == $altitude->{$last} - 1) { }
841 4 0 unless $self->climate eq "desert"
843 0 0 if ($self->with_river($rivers, $coordinates)) { }
845 0 0 unless $world->{$coordinates} =~ s/light-grey/light-green/u
852 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
857 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
897 0 76 if $step == $i++
907 44 32 if ($step >= 10)
933 0 4 shift() ? :
962 0 4 if ($step > 0)
977 0 4 if ($step > 0)
989 2 2 if $url
991 2 2 if wantarray