| 1 | package Game::Backgammon::Move; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use Object::Proto::Sugar -types; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | our $VERSION = '0.03'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | has player => ( | ||||||||||||||||||||||||||||||||||||||||||
| 11 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 12 | isa => Str | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ); | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | has [qw/from to/] => ( | ||||||||||||||||||||||||||||||||||||||||||
| 16 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 17 | isa => Str | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 8 | ); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | has die => ( | ||||||||||||||||||||||||||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | isa => Int | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 8 | ); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | has hit => ( | ||||||||||||||||||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | default => 0 | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 8 | ); | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 929350 | ▶ | sub is_bar { $_[0]->from eq 'bar' ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_bar: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 929351 | ▶ | sub is_off { $_[0]->to eq 'off' ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_off: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 2707889 | ▶ | sub notation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
notation: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2707889 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 2707889 | ▶ | return $self->from . '/' . $self->to . ($self->hit ? '*' : ''); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 2014 | ▶ | sub same_as { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
same_as: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 2014 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 2014 | ▶ | return 0 unless $other; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 1131 | ▶ | return ($self->from eq $other->from | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->from eq $other->from and $self->to eq $other->to and $self->hit == $other->hit
$self->from eq $other->from and $self->to eq $other->to
MC/DC100%3/3
$self->from eq $other->from and $self->to eq $other->to and $self->hit == $other->hit
$self->from eq $other->from
$self->to eq $other->to
$self->hit == $other->hit
Truth table100%4/4
A and B and C
A= $self->from eq $other->fromB= $self->to eq $other->toC= $self->hit == $other->hit
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | && $self->to eq $other->to | ||||||||||||||||||||||||||||||||||||||||||
| 44 | && $self->hit == $other->hit) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub stringify { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | return $_[0]->notation; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||||||||||||||||