| 1 | package Poker::Score::HighSuit; | ||||||||||||||||||||
| 2 | 1 | our $VERSION = '0.12'; | |||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 1 | ▶ | use Moo; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | Poker::Score::HighSuit - Score highest card of a specific suit. | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | =head1 VERSION | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | Version 0.12 | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | =cut | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | =head1 INTRODUCTION | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | Scoring system typically used in split-pot games like High Chicago where half the pot goes to the player holding the highest Spade. | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | =head1 SYNOPSIS | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | See Poker::Score for code example. | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 1 | extends 'Poker::Score'; | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | ▶ | sub score { | ||||||||||||||||||
|
Subroutine
score: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 31 | 0 | my ( $self, $cards, $suit ) = @_; | |||||||||||||||||||
| 32 | my ($high_card) = | ||||||||||||||||||||
| 33 | 0 | sort { $self->rank_val( $b->rank ) <=> $self->rank_val( $a->rank ) } | |||||||||||||||||||
| 34 | 0 | ▶ | grep { !$_->up_flag && $_->suit eq $suit } @$cards; | ||||||||||||||||||
|
Condition0%0/3
!$_->up_flag && $_->suit eq $suit
MC/DC0%0/2
!$_->up_flag && $_->suit eq $suit
!$_->up_flag
$_->suit eq $suit
Truth table0%0/3
not(A) && B
A= !$_->up_flagB= $_->suit eq $suit
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 0 | ▶ | if ($high_card) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | return { | ||||||||||||||||||||
| 38 | 0 | score => $self->rank_val( $high_card->rank ), | |||||||||||||||||||
| 39 | hand => [$high_card], | ||||||||||||||||||||
| 40 | }; | ||||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 1 | 1; | |||||||||||||||||||