File Coverage

blib/lib/Poker/Score/HighSuit.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 4 0.0
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 16 31.2


line stmt bran cond sub pod time code
1             package Poker::Score::HighSuit;
2 1     1   610 use Moo;
  1         1  
  1         4  
3              
4             =head1 NAME
5              
6             Poker::Score::HighSuit - Score highest card of a specific suit.
7              
8             =head1 VERSION
9              
10             Version 0.01
11              
12             =cut
13              
14             our $VERSION = '0.01';
15              
16             =head1 INTRODUCTION
17              
18             Scoring system typically used in split-pot games like High Chicago where half the pot goes to the player holding the highest Spade.
19              
20             =head1 SYNOPSIS
21              
22             See Poker::Score for code example.
23              
24             =cut
25              
26             extends 'Poker::Score';
27              
28             sub score {
29 0     0 1   my ( $self, $cards, $suit ) = @_;
30             my ($high_card) =
31 0           sort { $self->rank_val( $b->rank ) <=> $self->rank_val( $a->rank ) }
32 0 0         grep { !$_->up_flag && $_->suit eq $suit } @$cards;
  0            
33              
34 0 0         if ($high_card) {
35             return {
36 0           score => $self->rank_val( $high_card->rank ),
37             hand => [$high_card],
38             };
39             }
40             }
41              
42             1;