blib/lib/Game/Go/Marking.pm

filter: Statementstmt 97.6% 41 / 42 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 7 / 7 totaltotal 95.7% 68 / 71 CC 6 SCAR 4.9
CC
6
Cov
94%
is_dead
2.1
is_seki
2.1
turn
2.0
CRAP 1.6
« blib/lib/Game/Go/Board.pm ↑ Summary Go.xs »
1 package Game::Go::Marking;
2  
3 25 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 25 ▶use Object::Proto::Sugar -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 25 ▶use Game::Go::Rules;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 25 our $VERSION = '0.03';
12  
13 25 has proposer => (is => 'rw');
14 25 has answerer => (is => 'rw');
15  
16 25 has proposed => (is => 'rw', default => 0);
17  
18 25 has dead => (is => 'rw', isa => HashRef, default => {});
19 25 has seki => (is => 'rw', isa => HashRef, default => {});
20  
21 162 ▶sub turn { $_[0]->proposed ? $_[0]->answerer : $_[0]->proposer }
Subroutine turn: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->proposed ? : 63 99 162
22  
23 55 ▶sub dead_points { [ sort { $a <=> $b } keys %{ $_[0]->dead } ] }
Subroutine dead_points: called CC=1 SCAR=0.4
Pod documented
24 32 ▶sub seki_points { [ sort { $a <=> $b } keys %{ $_[0]->seki } ] }
Subroutine seki_points: called CC=1 SCAR=0.0
Pod documented
25  
26 2 ▶sub is_dead { $_[0]->dead->{ $_[1] } ? 1 : 0 }
Subroutine is_dead: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->dead->{$_[1]} ? : 0 2 2
27 147 ▶sub is_seki { $_[0]->seki->{ $_[1] } ? 1 : 0 }
Subroutine is_seki: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->seki->{$_[1]} ? : 0 147 147
28  
29 12 ▶sub toggle_dead {
Subroutine toggle_dead: called CC=2 SCAR=6.9
Pod documented
30 12 my ($self, $id) = @_;
31 12 ▶ if ($self->dead->{$id}) { delete $self->dead->{$id}; return 0 }
Branch: 1 branch
BranchTrueFalseTotal
if ($self->dead->{$id}) 1 11 12
32 11 $self->dead->{$id} = 1;
33 11 return 1;
34 }
35  
36 12 ▶sub toggle_seki {
Subroutine toggle_seki: called CC=2 SCAR=6.9
Pod documented
37 12 my ($self, $pt) = @_;
38 12 ▶ if ($self->seki->{$pt}) { delete $self->seki->{$pt}; return 0 }
Branch: 1 branch
BranchTrueFalseTotal
if ($self->seki->{$pt}) 1 11 12
39 11 $self->seki->{$pt} = 1;
40 11 return 1;
41 }
42  
43 25 1;
44  
45 __END__
« blib/lib/Game/Go/Board.pm ↑ Summary Go.xs »