blib/lib/Game/Go/Marking.pm

filter: Statementstmt 100% 42 / 42 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 7 / 7 totaltotal 98.5% 70 / 71 CC 6 SCAR 4.7
CC
6
Cov
98%
is_seki
2.1
turn
2.0
is_dead
2.0
CRAP 1.6
« blib/lib/Game/Go/Board.pm ↑ Summary Go.xs »
1 package Game::Go::Marking;
2  
3 47 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 47 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 47 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 47 ▶use Object::Proto::Sugar -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 47 ▶use Game::Go::Rules;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 47 our $VERSION = '0.05';
12  
13 47 has proposer => (is => 'rw');
14 47 has answerer => (is => 'rw');
15  
16 47 has proposed => (is => 'rw', default => 0);
17  
18 47 has dead => (is => 'rw', isa => HashRef, default => {});
19 47 has seki => (is => 'rw', isa => HashRef, default => {});
20  
21 307 ▶sub turn { $_[0]->proposed ? $_[0]->answerer : $_[0]->proposer }
Subroutine turn: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->proposed ? : 108 199 307
22  
23 100 ▶sub dead_points { [ sort { $a <=> $b } keys %{ $_[0]->dead } ] }
Subroutine dead_points: called CC=1 SCAR=0.0
Pod documented
24 46 ▶sub seki_points { [ sort { $a <=> $b } keys %{ $_[0]->seki } ] }
Subroutine seki_points: called CC=1 SCAR=0.0
Pod documented
25  
26 14 ▶sub is_dead { $_[0]->dead->{ $_[1] } ? 1 : 0 }
Subroutine is_dead: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->dead->{$_[1]} ? : 4 10 14
27 311 ▶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 311 311
28  
29 48 ▶sub toggle_dead {
Subroutine toggle_dead: called CC=2 SCAR=6.9
Pod documented
30 48 my ($self, $id) = @_;
31 48 ▶ if ($self->dead->{$id}) { delete $self->dead->{$id}; return 0 }
Branch: 1 branch
BranchTrueFalseTotal
if ($self->dead->{$id}) 1 47 48
32 47 $self->dead->{$id} = 1;
33 47 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 47 1;
44  
45 __END__
« blib/lib/Game/Go/Board.pm ↑ Summary Go.xs »