Game/Badacey.pm

filter: Statementstmt 100% 53 / 53 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 14 / 14 Podpod n/a totaltotal 82.2% 74 / 90 CC 8 SCAR 10.2
CC
8
Cov
86%
__ANON__
5.5
__ANON__
4.7
BEGIN
1.0
CRAP 2.8
« Game/HoldemJokersWild.pm ↑ Summary Game/Badeucy.pm »
1 package Poker::Game::Badacey;
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::Badugi;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Poker::Eval::Community;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Poker::Score::Badugi;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Poker::Score::LowA5;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 Poker::Game::Badacey - Badacey (Badugi + A-5 low split)
16  
17 =head1 VERSION
18  
19 Version 0.12
20  
21 =cut
22  
23  
24 =head1 DESCRIPTION
25  
26 Badacey: five hole cards, triple draw. Split between Badugi (best 1-4
27 card badugi from the five) and A-5 five-card low.
28  
29 C<evaluate> sets high-side Badugi on C<score>/C<name>/C<best_combo> and
30 A-5 low on C<low_score>/C<low_name>/C<low_combo>.
31  
32 =cut
33  
34 1 extends 'Poker::Game';
35  
36 1 ▶has '+hole_count' => ( default => sub { 5 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
37 1 ▶has '+board_size' => ( default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
38 1 ▶has '+max_draw_rounds' => ( default => sub { 3 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
39  
40 has 'low_scorer' => (
41 is => 'ro',
42 lazy => 1,
43 1 ▶ builder => sub { Poker::Score::LowA5->new },
Subroutine _build_low_scorer: called CC=1 SCAR=0.0
44 1 );
45  
46 has 'low_eval' => (
47 is => 'ro',
48 lazy => 1,
49 1 ▶ builder => sub {
Subroutine _build_low_eval: called CC=1 SCAR=0.0
50 1 my $self = shift;
51 1 Poker::Eval::Community->new( scorer => $self->low_scorer );
52 },
53 1 );
54  
55 1 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=4 SCAR=15.5
56 1 my ( $orig, $class, @args ) = @_;
57 1 my $args = $class->$orig(@args);
58 1 ▶ $args = {} unless ref $args eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "HASH" 0 1 1
59 1 ▶ $args->{scorer} //= Poker::Score::Badugi->new;
Condition33%1/3
$args->{"scorer"} //= "Poker::Score::Badugi"->new
l!l&&r!l&&!r
010
MC/DC0%0/2
$args->{"scorer"} //= "Poker::Score::Badugi"->new
$args->{"scorer"} "Poker::Score::Badugi"->new
Truth table33%1/3
A //= B
A= $args->{"scorer"}B= "Poker::Score::Badugi"->new
ABresult
1X1
011
000
60 $args->{eval_engine} //= Poker::Eval::Badugi->new(
61 scorer => $args->{scorer},
62 1 ▶ );
Condition33%1/3
$args->{"eval_engine"} //= "Poker::Eval::Badugi"->new("scorer", $args->{"scorer"})
l!l&&r!l&&!r
010
MC/DC0%0/2
$args->{"eval_engine"} //= "Poker::Eval::Badugi"->new("scorer", $args->{"scorer"})
$args->{"eval_engine"} "Poker::Eval::Badugi"->new("scorer", $args->{"scorer"})
Truth table33%1/3
A //= B
A= $args->{"eval_engine"}B= "Poker::Eval::Badugi"->new("scorer", $args->{"scorer"})
ABresult
1X1
011
000
63 1 return $args;
64 1 };
65  
66 1 ▶around evaluate => sub {
Subroutine __ANON__: called CC=5 SCAR=17.0
67 1 my ( $orig, $self, $arg ) = @_;
68 1 my $hand = $self->$orig($arg);
69  
70 1 ▶ my $hole =
Branch: 2 branches
BranchTrueFalseTotal
ref $arg eq 'ARRAY' ? : 0 1 1
$arg->isa('Poker::Hand') ? : 1 0 1
71 ref $arg eq 'ARRAY' ? $arg
72 : $arg->isa('Poker::Hand') ? $arg->cards
73 : $hand->cards;
74  
75 1 $self->low_eval->community_cards( [] );
76 1 my $low = $self->low_eval->best_hand($hole);
77  
78 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
79 1 $target->low_score( $low->score );
80 1 $target->low_name( $low->name );
81 1 $target->low_combo( $low->best_combo );
82 1 return $target;
83 1 };
84  
85 1 1;
« Game/HoldemJokersWild.pm ↑ Summary Game/Badeucy.pm »