Game/Badugi.pm

filter: Statementstmt 100% 31 / 31 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 82.6% 43 / 52 CC 4 SCAR 8.1
CC
4
Cov
87%
__ANON__
4.7
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« Deck.pm ↑ Summary Game/FiveCardDraw.pm »
1 package Poker::Game::Badugi;
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::Score::Badugi;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Poker::Game::Badugi - Badugi
14  
15 =head1 VERSION
16  
17 Version 0.12
18  
19 =cut
20  
21  
22 =head1 SYNOPSIS
23  
24 use Poker::Game::Badugi;
25  
26 my $game = Poker::Game::Badugi->new;
27 my $hero = $game->deal_hole(['As','2d','3c','4h']);
28 $game->evaluate($hero);
29 # optional draws:
30 $game->discard($hero, 'As');
31 $game->draw($hero, ['5s']);
32  
33 =head1 DESCRIPTION
34  
35 Badugi: four hole cards, triple draw, Badugi ranking (unique ranks and
36 suits; aces low; fewer cards can still make a hand).
37  
38 =cut
39  
40 1 extends 'Poker::Game';
41  
42 2 ▶has '+hole_count' => ( default => sub { 4 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
43 2 ▶has '+board_size' => ( default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
44 2 ▶has '+max_draw_rounds' => ( default => sub { 3 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
45  
46 2 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=4 SCAR=15.5
47 2 my ( $orig, $class, @args ) = @_;
48 2 my $args = $class->$orig(@args);
49 2 ▶ $args = {} unless ref $args eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "HASH" 0 2 2
50 2 ▶ $args->{scorer} //= Poker::Score::Badugi->new;
Condition33%1/3
$args->{"scorer"} //= "Poker::Score::Badugi"->new
l!l&&r!l&&!r
020
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
51 $args->{eval_engine} //= Poker::Eval::Badugi->new(
52 scorer => $args->{scorer},
53 2 ▶ );
Condition33%1/3
$args->{"eval_engine"} //= "Poker::Eval::Badugi"->new("scorer", $args->{"scorer"})
l!l&&r!l&&!r
020
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
54 2 return $args;
55 1 };
56  
57 1 1;
« Deck.pm ↑ Summary Game/FiveCardDraw.pm »