Game/SevenCardStudHiLo.pm

filter: Statementstmt 93.8% 46 / 49 Branchbran 50.0% 5 / 10 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 73.0% 65 / 89 CC 10 SCAR 16.1
CC
10
Cov
77%
__ANON__
9.7
__ANON__
4.7
BEGIN
1.0
CRAP 5.0
« Game/OmahaHiLo.pm ↑ Summary Eval.pm »
1 package Poker::Game::SevenCardStudHiLo;
2 1 our $VERSION = '0.12';
3  
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Poker::Eval::Community;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Poker::Score::High;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Poker::Score::Low8;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 NAME
13  
14 Poker::Game::SevenCardStudHiLo - Seven-card stud high/low 8-or-better
15  
16 =head1 VERSION
17  
18 Version 0.12
19  
20 =cut
21  
22  
23 =head1 DESCRIPTION
24  
25 Seven-card stud hi-lo. High uses highball; low uses 8-or-better.
26 Sets C<low_score> / C<low_name> / C<low_combo> when the hand qualifies.
27  
28 =cut
29  
30 1 extends 'Poker::Game::Stud';
31  
32 has 'low_scorer' => (
33 is => 'ro',
34 lazy => 1,
35 1 ▶ builder => sub { Poker::Score::Low8->new },
Subroutine __ANON__: called CC=1 SCAR=0.0
36 1 );
37  
38 has 'low_eval' => (
39 is => 'ro',
40 lazy => 1,
41 1 ▶ builder => sub {
Subroutine _build_low_eval: called CC=1 SCAR=0.0
42 1 my $self = shift;
43 1 Poker::Eval::Community->new( scorer => $self->low_scorer );
44 },
45 1 );
46  
47 1 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=4 SCAR=15.5
48 1 my ( $orig, $class, @args ) = @_;
49 1 my $args = $class->$orig(@args);
50 1 ▶ $args = {} unless ref $args eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "HASH" 0 1 1
51 1 ▶ $args->{scorer} //= Poker::Score::High->new;
Condition33%1/3
$args->{"scorer"} //= "Poker::Score::High"->new
l!l&&r!l&&!r
010
MC/DC0%0/2
$args->{"scorer"} //= "Poker::Score::High"->new
$args->{"scorer"} "Poker::Score::High"->new
Truth table33%1/3
A //= B
A= $args->{"scorer"}B= "Poker::Score::High"->new
ABresult
1X1
011
000
52 $args->{eval_engine} //= Poker::Eval::Community->new(
53 scorer => $args->{scorer},
54 1 ▶ );
Condition33%1/3
$args->{"eval_engine"} //= "Poker::Eval::Community"->new("scorer", $args->{"scorer"})
l!l&&r!l&&!r
010
MC/DC0%0/2
$args->{"eval_engine"} //= "Poker::Eval::Community"->new("scorer", $args->{"scorer"})
$args->{"eval_engine"} "Poker::Eval::Community"->new("scorer", $args->{"scorer"})
Truth table33%1/3
A //= B
A= $args->{"eval_engine"}B= "Poker::Eval::Community"->new("scorer", $args->{"scorer"})
ABresult
1X1
011
000
55 1 return $args;
56 1 };
57  
58 1 ▶around evaluate => sub {
Subroutine __ANON__: called CC=7 SCAR=22.7
59 1 my ( $orig, $self, $arg ) = @_;
60 1 my $hand = $self->$orig($arg);
61  
62 1 ▶ my $hole =
Branch: 2 branches
BranchTrueFalseTotal
ref $arg eq 'ARRAY' ? : 0 1 1
$arg->isa('Poker::Hand') ? : 1 0 1
63 ref $arg eq 'ARRAY' ? $arg
64 : $arg->isa('Poker::Hand') ? $arg->cards
65 : $hand->cards;
66  
67 1 $self->low_eval->community_cards( [] );
68 1 my $low = $self->low_eval->best_hand($hole);
69 1 ▶ my $qualified = defined $low->score && $low->score > 0;
Condition33%1/3
defined $low->score && $low->score > 0
!ll&&!rl&&r
001
MC/DC0%0/2
defined $low->score && $low->score > 0
defined $low->score $low->score > 0
Truth table33%1/3
A && B
A= defined $low->scoreB= $low->score > 0
ABresult
0X0
100
111
70  
71 1 ▶ my $target = ( ref $arg && $arg->isa('Poker::Hand') ) ? $arg : $hand;
Branch: 1 branch
BranchTrueFalseTotal
ref $arg && $arg->isa('Poker::Hand') ? : 1 0 1
Condition33%1/3
ref $arg and $arg->isa("Poker::Hand")
!ll&&!rl&&r
001
MC/DC0%0/2
ref $arg and $arg->isa("Poker::Hand")
ref $arg $arg->isa("Poker::Hand")
Truth table33%1/3
A and B
A= ref $argB= $arg->isa("Poker::Hand")
ABresult
0X0
100
111
72 1 ▶ if ($qualified) {
Branch: 1 branch
BranchTrueFalseTotal
if ($qualified) { } 1 0 1
73 1 $target->low_score( $low->score );
74 1 $target->low_name( $low->name );
75 1 $target->low_combo( $low->best_combo );
76 }
77 else {
78 0 $target->low_score(undef);
79 0 $target->low_name(undef);
80 0 $target->low_combo([]);
81 }
82 1 return $target;
83 1 };
84  
85 1 1;
« Game/OmahaHiLo.pm ↑ Summary Eval.pm »