| 1 | package Poker::Game::HoldemJokersWild; | ||||||||||||||||||||
| 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::Dealer; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use Poker::Eval::Wild; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use Poker::Score::High; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | Poker::Game::HoldemJokersWild - Texas Hold'em with jokers wild | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | =head1 VERSION | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | Version 0.12 | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | use Poker::Game::HoldemJokersWild; | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | my $game = Poker::Game::HoldemJokersWild->new; | ||||||||||||||||||||
| 28 | my $hero = $game->deal_hole(['As', 'Jo1']); | ||||||||||||||||||||
| 29 | $game->flop(['Ah', 'Kc', '2d']); | ||||||||||||||||||||
| 30 | $game->turn('9s'); | ||||||||||||||||||||
| 31 | $game->river('3c'); | ||||||||||||||||||||
| 32 | $game->evaluate($hero); | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | =head1 DESCRIPTION | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | Texas Hold'em with a 54-card deck (two jokers). Jokers are always wild | ||||||||||||||||||||
| 37 | and may appear in the hole or on the board. Uses C<Poker::Eval::Wild> | ||||||||||||||||||||
| 38 | so any combination of hole + community is allowed (Hold'em rules), | ||||||||||||||||||||
| 39 | with wild substitution. | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | =cut | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 1 | extends 'Poker::Game'; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | ▶ | has '+hole_count' => ( default => sub { 2 } ); | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 46 | 1 | ▶ | has '+board_size' => ( default => sub { 5 } ); | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | has 'joker_count' => ( | ||||||||||||||||||||
| 49 | is => 'ro', | ||||||||||||||||||||
| 50 | 1 | ▶ | default => sub { 2 }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 51 | 1 | ); | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 1 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=18.1
| |||||||||||||||||||||
| 54 | 1 | my ( $orig, $class, @args ) = @_; | |||||||||||||||||||
| 55 | 1 | my $args = $class->$orig(@args); | |||||||||||||||||||
| 56 | 1 | ▶ | $args = {} unless ref $args eq 'HASH'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 1 | ▶ | my $jokers = $args->{joker_count} // 2; | ||||||||||||||||||
|
Condition50%1/2
$args->{"joker_count"} // 2
MC/DC0%0/1
$args->{"joker_count"} // 2
$args->{"joker_count"}
Truth table50%1/2
A
A= $args->{"joker_count"}
| |||||||||||||||||||||
| 59 | 1 | ▶ | $args->{scorer} //= Poker::Score::High->new; | ||||||||||||||||||
|
Condition33%1/3
$args->{"scorer"} //= "Poker::Score::High"->new
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
| |||||||||||||||||||||
| 60 | $args->{eval_engine} //= Poker::Eval::Wild->new( | ||||||||||||||||||||
| 61 | scorer => $args->{scorer}, | ||||||||||||||||||||
| 62 | 1 | ▶ | dealer => Poker::Dealer->new( joker_count => $jokers ), | ||||||||||||||||||
|
Condition33%1/3
$args->{"eval_engine"} //= "Poker::Eval::Wild"->new("scorer", $args->{"scorer"}, "dealer", "Poker::Dealer"->new("joker_count", $jokers))
MC/DC0%0/2
$args->{"eval_engine"} //= "Poker::Eval::Wild"->new("scorer", $args->{"scorer"}, "dealer", "Poker::Dealer"->new("joker_count", $jokers))
$args->{"eval_engine"}
"Poker::Eval::Wild"->new("scorer", $args->{"scorer"}, "dealer", "Poker::Dealer"->new("joker_count", $jokers))
Truth table33%1/3
A //= B
A= $args->{"eval_engine"}B= "Poker::Eval::Wild"->new("scorer", $args->{"scorer"}, "dealer", "Poker::Dealer"->new("joker_count", $jokers))
| |||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 1 | return $args; | |||||||||||||||||||
| 66 | 1 | }; | |||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 1 | 1; | |||||||||||||||||||