| 1 | package Game::Backgammon::Shots; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | our @EXPORT_OK = qw(shots_at); | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | my @SHOTS; | |||||||||||||||||||||||||||||||||||||||||
| 12 | { | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 9 | for my $d (1 .. 24) { | |||||||||||||||||||||||||||||||||||||||||
| 14 | 216 | my $n = 0; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 216 | for my $a (1 .. 6) { | |||||||||||||||||||||||||||||||||||||||||
| 16 | 1296 | for my $b (1 .. 6) { | |||||||||||||||||||||||||||||||||||||||||
| 17 | 7776 | my %reach; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 7776 | ▶ | if ($a == $b) { $reach{ $a * $_ } = 1 for 1 .. 4 } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 6480 | else { @reach{ $a, $b, $a + $b } = (1) x 3 } | |||||||||||||||||||||||||||||||||||||||||
| 20 | 7776 | ▶ | $n++ if $reach{$d}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 216 | $SHOTS[$d] = $n; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 158327 | ▶ | sub shots_at { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shots_at: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 158327 | my ($distance) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 158327 | ▶ | return 0 unless defined $distance && $distance >= 1 && $distance <= 24; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $distance and $distance >= 1 and $distance <= 24
defined $distance and $distance >= 1
MC/DC66%2/3
defined $distance and $distance >= 1 and $distance <= 24
defined $distance
$distance >= 1
$distance <= 24
Truth table75%3/4
A and B and C
A= defined $distanceB= $distance >= 1C= $distance <= 24
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 158325 | return $SHOTS[$distance]; | |||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub table { return [ @SHOTS ] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
table: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||||||||||||||||