| 1 | package Game::Mahjong::Tally; | ||||||||||
| 2 | |||||||||||
| 3 | 34 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 34 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 34 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 34 | ▶ | use Object::Proto::Sugar -types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 34 | our $VERSION = '0.02'; | |||||||||
| 10 | |||||||||||
| 11 | 34 | has points => (is => 'ro', isa => Int, required => 1); | |||||||||
| 12 | |||||||||||
| 13 | 34 | has basic => (is => 'ro', isa => Int, required => 1); | |||||||||
| 14 | |||||||||||
| 15 | 34 | has flowers => (is => 'ro', isa => Int, default => 0); | |||||||||
| 16 | |||||||||||
| 17 | 34 | has fans => (is => 'ro', isa => ArrayRef, default => []); | |||||||||
| 18 | |||||||||||
| 19 | 34 | has split => (is => 'ro'); | |||||||||
| 20 | |||||||||||
| 21 | 34 | has minimum_met => (is => 'ro', default => 0); | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub keys_of { return map { $_->{key} } @{ $_[0]->fans } } | ||||||||
|
Subroutine
keys_of: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | |||||||||||
| 25 | 47 | ▶ | sub has_fan { | ||||||||
|
Subroutine
has_fan: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 26 | 47 | my ($self, $key) = @_; | |||||||||
| 27 | 47 | ▶ | for my $f (@{ $self->fans }) { return $f->{times} if $f->{key} eq $key } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 25 | return 0; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub describe { | ||||||||
|
Subroutine
describe: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 32 | 0 | my ($self) = @_; | |||||||||
| 33 | 0 | ▶ | return join(', ', map { $_->{name} . ($_->{times} > 1 ? " x$_->{times}" : '') . " ($_->{total})" } @{ $self->fans }) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | . ' = ' . $self->points; | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 34 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||