| 1 | package Games::Go::Cinderblock::MoveResult; | ||||||||||
| 2 | 6 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 6 | has move_attempt => ( | |||||||||
| 5 | isa => 'Games::Go::Cinderblock::MoveAttempt', # Games::Go::Cinderblock::MoveAttempt? | ||||||||||
| 6 | is => 'ro', | ||||||||||
| 7 | required => 1, | ||||||||||
| 8 | ); | ||||||||||
| 9 | |||||||||||
| 10 | 6 | has rulemap => ( | |||||||||
| 11 | isa => 'Games::Go::Cinderblock::Rulemap', | ||||||||||
| 12 | is => 'ro', #shouldn't change. | ||||||||||
| 13 | required => 1, | ||||||||||
| 14 | ); | ||||||||||
| 15 | 6 | has basis_state=> ( | |||||||||
| 16 | is => 'ro', | ||||||||||
| 17 | required => 1, | ||||||||||
| 18 | isa => 'Games::Go::Cinderblock::State', | ||||||||||
| 19 | ); | ||||||||||
| 20 | |||||||||||
| 21 | 6 | has resulting_state=> ( | |||||||||
| 22 | is => 'ro', | ||||||||||
| 23 | # required if success? | ||||||||||
| 24 | isa => 'Games::Go::Cinderblock::State', | ||||||||||
| 25 | ); | ||||||||||
| 26 | 6 | has delta => ( | |||||||||
| 27 | lazy => 1, | ||||||||||
| 28 | is => 'ro', | ||||||||||
| 29 | builder => '_derive_delta', | ||||||||||
| 30 | isa => 'Games::Go::Cinderblock::Delta', | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 6 | has succeeded => ( | |||||||||
| 34 | isa => 'Bool', | ||||||||||
| 35 | is => 'ro', | ||||||||||
| 36 | # lazy => 1, | ||||||||||
| 37 | # builder => '_determine_success', | ||||||||||
| 38 | required => 1, | ||||||||||
| 39 | ); | ||||||||||
| 40 | 6 | has reason => ( | |||||||||
| 41 | isa => 'Str', | ||||||||||
| 42 | is => 'ro', | ||||||||||
| 43 | required => 0, | ||||||||||
| 44 | ); | ||||||||||
| 45 | |||||||||||
| 46 | 1 | ▶ | sub _derive_delta{ | ||||||||
|
Subroutine
_derive_delta: called CC=1 SCAR=0.0
| |||||||||||
| 47 | 1 | my $self = shift; | |||||||||
| 48 | 1 | return $self->basis_state->delta_to($self->resulting_state); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | # meh | ||||||||||
| 52 | 4 | ▶ | sub failed{ | ||||||||
|
Subroutine
failed: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | 4 | my $self = shift; | |||||||||
| 54 | 4 | ▶ | return ($self->succeeded ? 0 : 1); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | } | ||||||||||
| 56 | 6 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||