| 1 | package Poker::Game; | ||||||||||||||||||||||||||||
| 2 | 11 | our $VERSION = '0.12'; | |||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 11 | ▶ | use Poker::Dealer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use Poker::Hand; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 NAME | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Poker::Game - Base class for named poker variants | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | use Poker::Game::Holdem; | ||||||||||||||||||||||||||||
| 18 | use feature qw(say); | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # choose a game | ||||||||||||||||||||||||||||
| 21 | my $game = Poker::Game::Holdem->new( iterations => 1000 ); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | # deal hole cards | ||||||||||||||||||||||||||||
| 24 | my $hero = $game->deal_hole(['As', 'Kd']); | ||||||||||||||||||||||||||||
| 25 | my $villain = $game->deal_hole(['7h', '7c']); | ||||||||||||||||||||||||||||
| 26 | # or $game->deal_hole() for random cards; | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # calculate equity for each player | ||||||||||||||||||||||||||||
| 29 | $game->equity([ $hero, $villain ]); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # hero has ~45 percent equity | ||||||||||||||||||||||||||||
| 32 | say $hero->ev; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # villain has ~55 percent equity | ||||||||||||||||||||||||||||
| 35 | say $villain->ev; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # here comes the flop | ||||||||||||||||||||||||||||
| 38 | $game->flop(['Ah', 'Kc', '2d']); | ||||||||||||||||||||||||||||
| 39 | # or $game->flop() for random cards; | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # calculate equity again after the flop | ||||||||||||||||||||||||||||
| 42 | $game->equity([ $hero, $villain ]); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # hero now has ~93 percent equity after making two pair | ||||||||||||||||||||||||||||
| 45 | say $hero->ev; | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | # turn and river | ||||||||||||||||||||||||||||
| 48 | $game->turn('9s'); # deal specific card | ||||||||||||||||||||||||||||
| 49 | $game->river(); # deal random card | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | # see who won and why | ||||||||||||||||||||||||||||
| 52 | $game->evaluate($hero); | ||||||||||||||||||||||||||||
| 53 | say $game->board_string; # AsKdAhKc9d | ||||||||||||||||||||||||||||
| 54 | say $hero->name; # Two Pair | ||||||||||||||||||||||||||||
| 55 | say $hero->score; # numerical strength | ||||||||||||||||||||||||||||
| 56 | say $hero->best_combo_flat; # show cards in human readable form | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # reset board and shuffle deck for the next game | ||||||||||||||||||||||||||||
| 59 | $game->reset; | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | For a full list of games, eval engines, and scorers, see | ||||||||||||||||||||||||||||
| 64 | L<Poker::Eval/AVAILABLE COMPONENTS>. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 EQUITY | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | B<Equity> is the estimated share of the pot a hand wins if the remaining | ||||||||||||||||||||||||||||
| 69 | board is completed many times at random from the undealt cards. | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | Each simulation awards 1.0 pot unit in total: | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =over 4 | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =item * Sole winner: that hand receives 1.0 | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =item * N hands tied for best: each receives 1/N | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =back | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =over 4 | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =item hole_count | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | How many hole cards each player is dealt (set by the subclass). | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =item board_size | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | Number of community cards (0 for draw/stud/Badugi). | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =item iterations | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | Monte Carlo sample size for C<equity> (default 1000). | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =item max_draw_rounds / draws_left | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | Draw-game discard rounds allowed / remaining. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =item pending_discards / pending_draws | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | Phase flags. Crazy Pineapple sets C<pending_discards> after the flop | ||||||||||||||||||||||||||||
| 104 | until each player discards; draw games set C<pending_draws> after | ||||||||||||||||||||||||||||
| 105 | C<discard> until C<draw>. | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =back | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =cut | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | has 'hole_count' => ( | ||||||||||||||||||||||||||||
| 112 | is => 'ro', | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | default => sub { 2 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 114 | 11 | ); | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | has 'board_size' => ( | ||||||||||||||||||||||||||||
| 117 | is => 'ro', | ||||||||||||||||||||||||||||
| 118 | 0 | ▶ | default => sub { 5 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 119 | 11 | ); | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | has 'iterations' => ( | ||||||||||||||||||||||||||||
| 122 | is => 'rw', | ||||||||||||||||||||||||||||
| 123 | 26 | ▶ | default => sub { 1000 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 124 | 11 | ); | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | has 'max_draw_rounds' => ( | ||||||||||||||||||||||||||||
| 127 | is => 'ro', | ||||||||||||||||||||||||||||
| 128 | 28 | ▶ | default => sub { 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 129 | 11 | ); | |||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | has 'draws_left' => ( | ||||||||||||||||||||||||||||
| 132 | is => 'rw', | ||||||||||||||||||||||||||||
| 133 | 37 | ▶ | default => sub { 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 134 | 11 | ); | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | has 'eval_engine' => ( | ||||||||||||||||||||||||||||
| 137 | is => 'ro', | ||||||||||||||||||||||||||||
| 138 | required => 1, | ||||||||||||||||||||||||||||
| 139 | 37 | ▶ | isa => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 140 | 37 | ▶ | die "eval_engine must be a Poker::Eval" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | unless $_[0]->isa('Poker::Eval'); | ||||||||||||||||||||||||||||
| 142 | }, | ||||||||||||||||||||||||||||
| 143 | 11 | ); | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | has 'scorer' => ( | ||||||||||||||||||||||||||||
| 146 | is => 'ro', | ||||||||||||||||||||||||||||
| 147 | required => 1, | ||||||||||||||||||||||||||||
| 148 | 37 | ▶ | isa => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 149 | 37 | ▶ | die "scorer must be a Poker::Score" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | unless $_[0]->isa('Poker::Score'); | ||||||||||||||||||||||||||||
| 151 | }, | ||||||||||||||||||||||||||||
| 152 | 11 | ); | |||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | has 'dealer' => ( | ||||||||||||||||||||||||||||
| 155 | is => 'ro', | ||||||||||||||||||||||||||||
| 156 | lazy => 1, | ||||||||||||||||||||||||||||
| 157 | builder => '_build_dealer', | ||||||||||||||||||||||||||||
| 158 | 37 | ▶ | isa => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 159 | 37 | ▶ | die "Not a Poker::Dealer" unless $_[0]->isa('Poker::Dealer'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | }, | ||||||||||||||||||||||||||||
| 161 | 11 | ); | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 37 | ▶ | sub _build_dealer { | ||||||||||||||||||||||||||
|
Subroutine
_build_dealer: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 164 | 37 | my $self = shift; | |||||||||||||||||||||||||||
| 165 | 37 | return $self->eval_engine->dealer; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | has 'board' => ( | ||||||||||||||||||||||||||||
| 169 | is => 'rw', | ||||||||||||||||||||||||||||
| 170 | 37 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 171 | 40 | ▶ | isa => sub { die "Not an array ref" unless ref( $_[0] ) eq 'ARRAY' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 11 | ); | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | has 'pending_discards' => ( | ||||||||||||||||||||||||||||
| 175 | is => 'rw', | ||||||||||||||||||||||||||||
| 176 | 37 | ▶ | default => sub { 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 177 | 11 | ); | |||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | has 'pending_draws' => ( | ||||||||||||||||||||||||||||
| 180 | is => 'rw', | ||||||||||||||||||||||||||||
| 181 | 37 | ▶ | default => sub { 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 182 | 11 | ); | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 37 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 185 | 37 | my $self = shift; | |||||||||||||||||||||||||||
| 186 | 37 | ▶ | $self->eval_engine->scorer( $self->scorer ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | unless $self->eval_engine->scorer; | ||||||||||||||||||||||||||||
| 188 | 37 | $self->eval_engine->community_cards( $self->board ); | |||||||||||||||||||||||||||
| 189 | 37 | $self->draws_left( $self->max_draw_rounds ); | |||||||||||||||||||||||||||
| 190 | 37 | $self->dealer->shuffle_deck; | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 31 | ▶ | sub _assert_no_pending_actions { | ||||||||||||||||||||||||||
|
Subroutine
_assert_no_pending_actions: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 194 | 31 | my $self = shift; | |||||||||||||||||||||||||||
| 195 | 31 | ▶ | die "cannot deal board while discards are pending" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | if $self->pending_discards; | ||||||||||||||||||||||||||||
| 197 | 30 | ▶ | die "cannot deal board while draws are pending" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | if $self->pending_draws; | ||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =head1 METHODS | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | =head2 deal_hole | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | my $hand = $game->deal_hole; # random hole_count cards | ||||||||||||||||||||||||||||
| 206 | my $hand = $game->deal_hole(2); # random N cards | ||||||||||||||||||||||||||||
| 207 | my $hand = $game->deal_hole(['As','Kd']); # specific cards | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | Returns a C<Poker::Hand>. | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =cut | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 50 | ▶ | sub deal_hole { | ||||||||||||||||||||||||||
|
Subroutine
deal_hole: called CC=3 SCAR=13.5
Pod
documented
| |||||||||||||||||||||||||||||
| 214 | 50 | my ( $self, $arg ) = @_; | |||||||||||||||||||||||||||
| 215 | 50 | my $cards; | |||||||||||||||||||||||||||
| 216 | 50 | ▶ | if ( ref $arg eq 'ARRAY' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 50 | $cards = $self->deal_cards($arg); | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | else { | ||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $n = defined $arg ? $arg : $self->hole_count; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | $cards = $self->dealer->deal($n); | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | 50 | return Poker::Hand->new( cards => $cards ); | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | =head2 deal_cards | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | my $cards = $game->deal_cards(['As', 'Kd']); | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | Remove specific cards from the deck by name. Jokers are C<Jo1>, C<Jo2>, ... | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 110 | ▶ | sub deal_cards { | ||||||||||||||||||||||||||
|
Subroutine
deal_cards: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 235 | 110 | my ( $self, $names ) = @_; | |||||||||||||||||||||||||||
| 236 | 110 | return $self->dealer->deal_named($names); | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =head2 board_string | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | Community cards as a flat string (e.g. C<Ah7c2d>). | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | =cut | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 1 | ▶ | sub board_string { | ||||||||||||||||||||||||||
|
Subroutine
board_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 246 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 247 | 1 | return join '', map { $_->rank . $_->suit } @{ $self->board }; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =head2 flop / turn / river | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | $game->flop(['Ah','7c','2d']); # or random if omitted | ||||||||||||||||||||||||||||
| 253 | $game->turn('9s'); | ||||||||||||||||||||||||||||
| 254 | $game->river('3c'); | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | Deal the next community street. C<turn> and C<river> die if discards or | ||||||||||||||||||||||||||||
| 257 | draws are still pending (e.g. Crazy Pineapple before the mandatory discard). | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | =cut | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 18 | ▶ | sub flop { | ||||||||||||||||||||||||||
|
Subroutine
flop: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 262 | 18 | my ( $self, $cards ) = @_; | |||||||||||||||||||||||||||
| 263 | 18 | ▶ | die "flop requires an empty board" if @{ $self->board }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 18 | return $self->_deal_street( 3, $cards ); | |||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 16 | ▶ | sub turn { | ||||||||||||||||||||||||||
|
Subroutine
turn: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 268 | 16 | my ( $self, $cards ) = @_; | |||||||||||||||||||||||||||
| 269 | 16 | $self->_assert_no_pending_actions; | |||||||||||||||||||||||||||
| 270 | die "turn requires exactly 3 board cards" | ||||||||||||||||||||||||||||
| 271 | 15 | ▶ | unless @{ $self->board } == 3; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | 15 | return $self->_deal_street( 1, $cards ); | |||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 15 | ▶ | sub river { | ||||||||||||||||||||||||||
|
Subroutine
river: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 276 | 15 | my ( $self, $cards ) = @_; | |||||||||||||||||||||||||||
| 277 | 15 | $self->_assert_no_pending_actions; | |||||||||||||||||||||||||||
| 278 | die "river requires exactly 4 board cards" | ||||||||||||||||||||||||||||
| 279 | 15 | ▶ | unless @{ $self->board } == 4; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | 15 | return $self->_deal_street( 1, $cards ); | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 60 | ▶ | sub _normalize_cards { | ||||||||||||||||||||||||||
|
Subroutine
_normalize_cards: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 284 | 60 | my ( $self, $count, $specific ) = @_; | |||||||||||||||||||||||||||
| 285 | 60 | ▶ | return undef unless defined $specific; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 286 | 60 | ▶ | if ( ref $specific eq 'ARRAY' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 287 | 25 | return $specific; | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | 35 | return [$specific]; | |||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 50 | ▶ | sub _deal_street { | ||||||||||||||||||||||||||
|
Subroutine
_deal_street: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 293 | 50 | my ( $self, $count, $specific ) = @_; | |||||||||||||||||||||||||||
| 294 | 50 | my $cards = $self->_normalize_cards( $count, $specific ); | |||||||||||||||||||||||||||
| 295 | 50 | my $new; | |||||||||||||||||||||||||||
| 296 | 50 | ▶ | if ($cards) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | 50 | ▶ | die "expected $count cards" unless @$cards == $count; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 298 | 50 | $new = $self->deal_cards($cards); | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | else { | ||||||||||||||||||||||||||||
| 301 | 0 | $new = $self->dealer->deal($count); | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | 50 | push @{ $self->board }, @$new; | |||||||||||||||||||||||||||
| 304 | 50 | $self->eval_engine->community_cards( $self->board ); | |||||||||||||||||||||||||||
| 305 | 50 | return $self->board; | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | =head2 can_runout | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | True when the game uses community cards, the board is incomplete, and no | ||||||||||||||||||||||||||||
| 311 | discards/draws are pending. | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =cut | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 6 | ▶ | sub can_runout { | ||||||||||||||||||||||||||
|
Subroutine
can_runout: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 316 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 317 | 6 | ▶ | return 0 unless $self->board_size > 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 318 | 6 | ▶ | return 0 if @{ $self->board } >= $self->board_size; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 319 | 5 | ▶ | return 0 if $self->pending_discards; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | 4 | ▶ | return 0 if $self->pending_draws; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | 4 | return 1; | |||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =head2 runout | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | $game->runout; # random remaining board | ||||||||||||||||||||||||||||
| 327 | $game->runout(['9s','3c']); # specific cards | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | Deal all remaining community cards. Dies unless C<can_runout> is true. | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =cut | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 1 | ▶ | sub runout { | ||||||||||||||||||||||||||
|
Subroutine
runout: called CC=4 SCAR=14.8
Pod
documented
| |||||||||||||||||||||||||||||
| 334 | 1 | my ( $self, $specific ) = @_; | |||||||||||||||||||||||||||
| 335 | 1 | ▶ | die "runout not legal in current state" unless $self->can_runout; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 336 | 1 | my $need = $self->board_size - @{ $self->board }; | |||||||||||||||||||||||||||
| 337 | 1 | my $cards = $self->_normalize_cards( $need, $specific ); | |||||||||||||||||||||||||||
| 338 | 1 | ▶ | if ($cards) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 339 | 1 | ▶ | die "expected $need cards" unless @$cards == $need; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 340 | 1 | push @{ $self->board }, @{ $self->deal_cards($cards) }; | |||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | else { | ||||||||||||||||||||||||||||
| 343 | 0 | push @{ $self->board }, @{ $self->dealer->deal($need) }; | |||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||
| 345 | 1 | $self->eval_engine->community_cards( $self->board ); | |||||||||||||||||||||||||||
| 346 | 1 | return $self->board; | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =head2 discard | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | $game->discard($hand, '7c'); | ||||||||||||||||||||||||||||
| 352 | $game->discard($hand, ['7c', '2h']); | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | Remove one or more hole cards from C<$hand>. | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | B<Draw games:> sets C<pending_draws> so C<draw> is expected next, and | ||||||||||||||||||||||||||||
| 357 | decrements toward C<max_draw_rounds>. | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | B<Crazy Pineapple:> after the flop each player must discard exactly one | ||||||||||||||||||||||||||||
| 360 | hole card (clearing C<pending_discards>) before C<turn> / C<river> are | ||||||||||||||||||||||||||||
| 361 | allowed. That path does not use C<draw>. | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | =cut | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 3 | ▶ | sub discard { | ||||||||||||||||||||||||||
|
Subroutine
discard: called CC=11 SCAR=25.3
Pod
documented
| |||||||||||||||||||||||||||||
| 366 | 3 | my ( $self, $hand, $which ) = @_; | |||||||||||||||||||||||||||
| 367 | 3 | ▶ | die "discard requires a Poker::Hand" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hand and $hand->isa("Poker::Hand")
MC/DC0%0/2
$hand and $hand->isa("Poker::Hand")
$hand
$hand->isa("Poker::Hand")
Truth table33%1/3
A and B
A= $handB= $hand->isa("Poker::Hand")
| |||||||||||||||||||||||||||||
| 368 | unless $hand && $hand->isa('Poker::Hand'); | ||||||||||||||||||||||||||||
| 369 | 3 | ▶ | die "no draws left" if $self->max_draw_rounds && $self->draws_left <= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->max_draw_rounds and $self->draws_left <= 0
MC/DC0%0/2
$self->max_draw_rounds and $self->draws_left <= 0
$self->max_draw_rounds
$self->draws_left <= 0
Truth table33%1/3
A and B
A= $self->max_draw_roundsB= $self->draws_left <= 0
| |||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 3 | ▶ | my @names = | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 372 | ref $which eq 'ARRAY' ? @$which | ||||||||||||||||||||||||||||
| 373 | : defined $which ? ($which) | ||||||||||||||||||||||||||||
| 374 | : die "discard requires a card or list"; | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 3 | my %want = map { $_ => 1 } @names; | |||||||||||||||||||||||||||
| 377 | 3 | my @keep; | |||||||||||||||||||||||||||
| 378 | my @removed; | ||||||||||||||||||||||||||||
| 379 | 3 | for my $card ( @{ $hand->cards } ) { | |||||||||||||||||||||||||||
| 380 | 14 | my $name = $card->rank . $card->suit; | |||||||||||||||||||||||||||
| 381 | 14 | ▶ | if ( $want{$name} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 382 | 4 | push @removed, $card; | |||||||||||||||||||||||||||
| 383 | 4 | delete $want{$name}; | |||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | else { | ||||||||||||||||||||||||||||
| 386 | 10 | push @keep, $card; | |||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | 3 | ▶ | die "card(s) not found in hand: " . join( ',', keys %want ) if keys %want; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 3 | $hand->cards( \@keep ); | |||||||||||||||||||||||||||
| 392 | 3 | ▶ | $self->pending_draws(1) if $self->max_draw_rounds; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 393 | 3 | return \@removed; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | =head2 draw | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | $game->draw($hand); # random refill to hole_count | ||||||||||||||||||||||||||||
| 399 | $game->draw($hand, ['As','Kd']); # specific replacements | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | Replace discarded cards up to C<hole_count>. Decrements C<draws_left>. | ||||||||||||||||||||||||||||
| 402 | Used by five-card draw and lowball draw games, not by Crazy Pineapple. | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | =cut | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | 3 | ▶ | sub draw { | ||||||||||||||||||||||||||
|
Subroutine
draw: called CC=11 SCAR=27.6
Pod
documented
| |||||||||||||||||||||||||||||
| 407 | 3 | my ( $self, $hand, $specific ) = @_; | |||||||||||||||||||||||||||
| 408 | 3 | ▶ | die "draw requires a Poker::Hand" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hand and $hand->isa("Poker::Hand")
MC/DC0%0/2
$hand and $hand->isa("Poker::Hand")
$hand
$hand->isa("Poker::Hand")
Truth table33%1/3
A and B
A= $handB= $hand->isa("Poker::Hand")
| |||||||||||||||||||||||||||||
| 409 | unless $hand && $hand->isa('Poker::Hand'); | ||||||||||||||||||||||||||||
| 410 | 3 | ▶ | die "draw not pending" unless $self->pending_draws || !$self->max_draw_rounds; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->pending_draws or not $self->max_draw_rounds
MC/DC0%0/2
$self->pending_draws or not $self->max_draw_rounds
$self->pending_draws
not $self->max_draw_rounds
Truth table33%1/3
A or not(B)
A= $self->pending_drawsB= not $self->max_draw_rounds
| |||||||||||||||||||||||||||||
| 411 | 3 | ▶ | die "no draws left" if $self->max_draw_rounds && $self->draws_left <= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->max_draw_rounds and $self->draws_left <= 0
MC/DC0%0/2
$self->max_draw_rounds and $self->draws_left <= 0
$self->max_draw_rounds
$self->draws_left <= 0
Truth table33%1/3
A and B
A= $self->max_draw_roundsB= $self->draws_left <= 0
| |||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 3 | my $need = $self->hole_count - @{ $hand->cards }; | |||||||||||||||||||||||||||
| 414 | 3 | ▶ | die "hand already has hole_count cards" if $need <= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | 3 | my $new; | |||||||||||||||||||||||||||
| 417 | 3 | ▶ | if ( defined $specific ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | 3 | my $cards = $self->_normalize_cards( $need, $specific ); | |||||||||||||||||||||||||||
| 419 | 3 | ▶ | die "expected $need cards" unless @$cards == $need; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | 3 | $new = $self->deal_cards($cards); | |||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||
| 422 | else { | ||||||||||||||||||||||||||||
| 423 | 0 | $new = $self->dealer->deal($need); | |||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | 3 | push @{ $hand->cards }, @$new; | |||||||||||||||||||||||||||
| 426 | 3 | $self->pending_draws(0); | |||||||||||||||||||||||||||
| 427 | 3 | ▶ | $self->draws_left( $self->draws_left - 1 ) if $self->max_draw_rounds; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 428 | 3 | return $hand; | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =head2 evaluate | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | $game->evaluate($hand); | ||||||||||||||||||||||||||||
| 434 | my $result = $game->evaluate(['As','Kd']); # or raw card list | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | Score the best hand under this game's rules. On a C<Poker::Hand>, sets: | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | =over 4 | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | =item * C<score> -- numerical strength for this ranking system (higher is better within that system) | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | =item * C<name> -- English label (e.g. C<Two Pair>) | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | =item * C<best_combo> -- cards used | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =item * C<low_score>, C<low_name>, C<low_combo> -- hi-lo games only, when the hand qualifies for low | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | =back | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | =cut | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | 26 | ▶ | sub evaluate { | ||||||||||||||||||||||||||
|
Subroutine
evaluate: called CC=5 SCAR=17.6
Pod
documented
| |||||||||||||||||||||||||||||
| 453 | 26 | my ( $self, $arg ) = @_; | |||||||||||||||||||||||||||
| 454 | 26 | ▶ | my $hole = | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 455 | ref $arg eq 'ARRAY' ? $arg | ||||||||||||||||||||||||||||
| 456 | : $arg->isa('Poker::Hand') ? $arg->cards | ||||||||||||||||||||||||||||
| 457 | : die "evaluate requires a Poker::Hand or array ref of cards"; | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | 26 | $self->eval_engine->community_cards( $self->board ); | |||||||||||||||||||||||||||
| 460 | 26 | my $result = $self->eval_engine->best_hand($hole); | |||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 26 | ▶ | if ( ref $arg && $arg->isa('Poker::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")
| |||||||||||||||||||||||||||||
| 463 | 26 | $arg->score( $result->score ); | |||||||||||||||||||||||||||
| 464 | 26 | $arg->name( $result->name ); | |||||||||||||||||||||||||||
| 465 | 26 | $arg->best_combo( $result->best_combo ); | |||||||||||||||||||||||||||
| 466 | 26 | return $arg; | |||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||
| 468 | 0 | return $result; | |||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | =head2 equity | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | $game->equity([ $hand1, $hand2, ... ]); | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | Monte Carlo equity from the current board state. Sets C<< $hand->ev >> | ||||||||||||||||||||||||||||
| 476 | on each hand (see L</EQUITY>). Alias: C<calc_ev>. | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | =cut | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | 12 | ▶ | sub equity { | ||||||||||||||||||||||||||
|
Subroutine
equity: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 481 | 12 | my ( $self, $hands ) = @_; | |||||||||||||||||||||||||||
| 482 | 12 | ▶ | die "equity requires an array ref of hands" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 483 | unless ref $hands eq 'ARRAY'; | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | 12 | my $engine = $self->eval_engine; | |||||||||||||||||||||||||||
| 486 | 12 | $engine->community_cards( $self->board ); | |||||||||||||||||||||||||||
| 487 | $engine->community_remaining( | ||||||||||||||||||||||||||||
| 488 | $self->board_size > 0 | ||||||||||||||||||||||||||||
| 489 | 12 | ▶ | ? $self->board_size - @{ $self->board } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 490 | : 0 | ||||||||||||||||||||||||||||
| 491 | ); | ||||||||||||||||||||||||||||
| 492 | 12 | $engine->hole_remaining(0); | |||||||||||||||||||||||||||
| 493 | 12 | $engine->simulations( $self->iterations ); | |||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | 12 | for my $h (@$hands) { | |||||||||||||||||||||||||||
| 496 | 25 | $h->wins(0); | |||||||||||||||||||||||||||
| 497 | 25 | $h->ev(0); | |||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 12 | $engine->calc_ev($hands); | |||||||||||||||||||||||||||
| 501 | 12 | return $hands; | |||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | 1 | ▶ | sub calc_ev { shift->equity(@_) } | ||||||||||||||||||||||||||
|
Subroutine
calc_ev: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | =head2 reset | ||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | Reset board and shuffle a fresh deck | ||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | =cut | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | 3 | ▶ | sub reset { | ||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 513 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 514 | 3 | $self->board( [] ); | |||||||||||||||||||||||||||
| 515 | 3 | $self->pending_discards(0); | |||||||||||||||||||||||||||
| 516 | 3 | $self->pending_draws(0); | |||||||||||||||||||||||||||
| 517 | 3 | $self->draws_left( $self->max_draw_rounds ); | |||||||||||||||||||||||||||
| 518 | 3 | $self->eval_engine->community_cards( [] ); | |||||||||||||||||||||||||||
| 519 | 3 | $self->dealer->shuffle_deck; | |||||||||||||||||||||||||||
| 520 | 3 | return $self; | |||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | Nathaniel Graham, C<< <ngraham at cpan.org> >> | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||
| 529 | Copyright 2016-2026 Nathaniel Graham. | ||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||
| 531 | =cut | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 11 | 1; | |||||||||||||||||||||||||||