| 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.02'; | |||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 27 | 147 | ▶ | sub is_seki { $_[0]->seki->{ $_[1] } ? 1 : 0 } | ||||||||
|
Subroutine
is_seki: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 39 | 11 | $self->seki->{$pt} = 1; | |||||||||
| 40 | 11 | return 1; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 25 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||