| 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
| |||||||||||||||||||||||||||||
| 59 | 1 | ▶ | $args->{scorer} //= Poker::Score::Badugi->new; | ||||||||||||||||||||||||||
|
Condition33%1/3
$args->{"scorer"} //= "Poker::Score::Badugi"->new
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
| |||||||||||||||||||||||||||||
| 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"})
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"})
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
ref $arg and $arg->isa("Poker::Hand")
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")
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||