| 1 | package Game::Cribbage::Rounds; | ||||||||||
| 2 | |||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 12 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 12 | ▶ | use Object::Proto::Sugar -types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 12 | ▶ | use Game::Cribbage::Round; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | has number => ( | ||||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | isa => Int | ||||||||||
| 12 | 12 | ); | |||||||||
| 13 | |||||||||||
| 14 | has history => ( | ||||||||||
| 15 | is => 'rw', | ||||||||||
| 16 | isa => ArrayRef, | ||||||||||
| 17 | default => [] | ||||||||||
| 18 | 12 | ); | |||||||||
| 19 | |||||||||||
| 20 | has current_round => ( | ||||||||||
| 21 | is => 'rw', | ||||||||||
| 22 | isa => Object, | ||||||||||
| 23 | 12 | ); | |||||||||
| 24 | |||||||||||
| 25 | 62 | ▶ | sub next_round { | ||||||||
|
Subroutine
next_round: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 26 | 62 | my ($self, $game, %args) = @_; | |||||||||
| 27 | 62 | ▶ | if (scalar @{$self->history} >= $self->number) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | die 'DISPLAY THE RESULT FOR THE GAME'; | |||||||||
| 29 | } | ||||||||||
| 30 | my $round = Game::Cribbage::Round->new( | ||||||||||
| 31 | 62 | number => scalar @{$self->history} + 1, | |||||||||
| 32 | %args | ||||||||||
| 33 | )->init($game); | ||||||||||
| 34 | 62 | push @{$self->history}, $round; | |||||||||
| 35 | 62 | $self->current_round($round); | |||||||||
| 36 | 62 | return $self; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 12 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||