Game/FiveCardDrawDeucesWild.pm

filter: Statementstmt 86.6% 39 / 45 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 90.9% 10 / 11 Podpod n/a totaltotal 75.0% 54 / 72 CC 8 SCAR 13.9
CC
8
Cov
77%
__ANON__
12.0
__ANON__
4.7
__ANON__
3.0
CRAP 4.0
« Eval.pm ↑ Summary Game/CourchevalHiLo.pm »
1 package Poker::Game::FiveCardDrawDeucesWild;
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::Wild;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Poker::Score::High;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Poker::Game::FiveCardDrawDeucesWild - Five-card draw, deuces wild
14  
15 =head1 VERSION
16  
17 Version 0.12
18  
19 =cut
20  
21  
22 =head1 SYNOPSIS
23  
24 use Poker::Game::FiveCardDrawDeucesWild;
25  
26 my $game = Poker::Game::FiveCardDrawDeucesWild->new;
27 my $hero = $game->deal_hole(['As','2d','2c','Kh','9s']);
28 # deuces are marked wild automatically after deal_hole
29 $game->evaluate($hero);
30  
31 =head1 DESCRIPTION
32  
33 Five-card draw with all 2s wild. Uses C<Poker::Eval::Wild>.
34  
35 =cut
36  
37 1 extends 'Poker::Game';
38  
39 1 ▶has '+hole_count' => ( default => sub { 5 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
40 1 ▶has '+board_size' => ( default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
41 1 ▶has '+max_draw_rounds' => ( default => sub { 1 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
42  
43 1 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=4 SCAR=15.5
44 1 my ( $orig, $class, @args ) = @_;
45 1 my $args = $class->$orig(@args);
46 1 ▶ $args = {} unless ref $args eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "HASH" 0 1 1
47 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
48 $args->{eval_engine} //= Poker::Eval::Wild->new(
49 scorer => $args->{scorer},
50 1 ▶ );
Condition33%1/3
$args->{"eval_engine"} //= "Poker::Eval::Wild"->new("scorer", $args->{"scorer"})
l!l&&r!l&&!r
010
MC/DC0%0/2
$args->{"eval_engine"} //= "Poker::Eval::Wild"->new("scorer", $args->{"scorer"})
$args->{"eval_engine"} "Poker::Eval::Wild"->new("scorer", $args->{"scorer"})
Truth table33%1/3
A //= B
A= $args->{"eval_engine"}B= "Poker::Eval::Wild"->new("scorer", $args->{"scorer"})
ABresult
1X1
011
000
51 1 return $args;
52 1 };
53  
54 1 ▶around deal_hole => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
55 1 my ( $orig, $self, @args ) = @_;
56 1 my $hand = $self->$orig(@args);
57 1 for my $card ( @{ $hand->cards } ) {
58 5 ▶ $card->wild_flag(1) if $card->rank eq '2';
Branch: 1 branch
BranchTrueFalseTotal
if $card->rank eq 2 2 3 5
59 }
60 1 return $hand;
61 1 };
62  
63 0 ▶around draw => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
64 0 my ( $orig, $self, $hand, @rest ) = @_;
65 0 my $result = $self->$orig( $hand, @rest );
66 0 for my $card ( @{ $hand->cards } ) {
67 0 ▶ $card->wild_flag(1) if $card->rank eq '2';
Branch: 1 branch
BranchTrueFalseTotal
if $card->rank eq 2 0 0 0
68 }
69 0 return $result;
70 1 };
71  
72 1 1;
« Eval.pm ↑ Summary Game/CourchevalHiLo.pm »