NAME

Poker::Eval - Deal, score, and evaluate poker hands

VERSION

0.12

SYNOPSIS

use Poker::Game::Holdem;
use feature qw(say);

# choose a game
my $game = Poker::Game::Holdem->new( iterations => 1000 );

# deal hole cards
my $hero    = $game->deal_hole(['As', 'Kd']);
my $villain = $game->deal_hole(['7h', '7c']);
# OR $game->deal_hole() for random cards;

# calculate equity for each player
$game->equity([ $hero, $villain ]);

# hero has ~45 percent equity 
say $hero->ev;

# villain has ~55 percent equity
say $villain->ev;

# here comes the flop
$game->flop(['Ah', 'Kc', '2d']);
# or $game->flop() for random cards;

# calculate equity again after the flop
$game->equity([ $hero, $villain ]);

# hero now has ~93 percent equity after making two pair
say $hero->ev;

# turn and river
$game->turn('9s'); # deal specific card
$game->river();    # deal random card

# see who won and why
$game->evaluate($hero);
say $game->board_string;    # Community Cards
say $hero->name;            # Two Pair
say $hero->score;           # numerical strength
say $hero->best_combo_flat; # show cards in human readable form

# reset board and shuffle deck for the next game
$game->reset;

AVAILABLE COMPONENTS

Games (Poker::Game::*)

Community  Poker::Game::Holdem
           Poker::Game::HoldemJokersWild
           Poker::Game::Pineapple
           Poker::Game::CrazyPineapple
           Poker::Game::Omaha
           Poker::Game::OmahaHiLo
           Poker::Game::Omaha5
           Poker::Game::Omaha5HiLo
           Poker::Game::Courcheval
           Poker::Game::CourchevalHiLo

Draw       Poker::Game::FiveCardDraw
           Poker::Game::FiveCardDrawDeucesWild
           Poker::Game::FiveCardDrawJokersWild
           Poker::Game::Low27SingleDraw
           Poker::Game::Low27TripleDraw
           Poker::Game::LowA5SingleDraw
           Poker::Game::LowA5TripleDraw

Stud       Poker::Game::SevenCardStud
           Poker::Game::SevenCardStudHiLo
           Poker::Game::Razz
           Poker::Game::Stud          (base class)

Badugi     Poker::Game::Badugi
           Poker::Game::Badacey
           Poker::Game::Badeucy

Evaluation engines (Poker::Eval::*)

Poker::Eval::Community   any hole + community (Hold'em-style)
Poker::Eval::Omaha       exactly 2 hole + 3 community
Poker::Eval::Wild        wild cards (jokers / deuces, etc.)
Poker::Eval::Badugi      Badugi selection
Poker::Eval::Badugi27    Badugi with aces high / 2-7 flavor
Poker::Eval::HighSuit    high-suit style
Poker::Eval::BlackMariah Black Mariah

Scoring systems (Poker::Score::*)

Poker::Score::High       standard highball
Poker::Score::Low8       8-or-better low
Poker::Score::Low27      deuce-to-seven low
Poker::Score::LowA5      ace-to-five low
Poker::Score::Badugi     Badugi rank
Poker::Score::Badugi27   Badugi 2-7 variant
Poker::Score::HighSuit   high suit

Poker::Score::Bring::*   bring-in helpers (High, Low, Wild)

Poker::Game::* subclasses wire a specific Eval + Scorer for you. Advanced use: pair an Eval engine with a Score object yourself.

SEE ALSO

Poker::Game, Poker::Score

ATTRIBUTES

community_cards

Array ref of Poker::Card objects representing community cards

scorer

Required attribute that identifies the scoring system. Must be a Poker::Score object.

dealer

Standard Poker::Dealer (52-card deck by default; pass joker_count for jokers).

simulations

Number of simulations for expected win rate (default 100).

METHODS

best_hand

Returns the best Poker::Hand for the given hole cards under this eval's rules.

calc_ev

Monte-Carlo expected win rate for an array ref of hands. Prefer Poker::Game's equity method for the named-game API.

Each simulation awards 1.0 pot unit total. If N hands tie for the best score, each receives 1/N. Equity is reported as a percentage of simulations (so the ev values across hands sum to approximately 100).

The dealer's current deck (already missing dealt hole and board cards) is cloned once; each simulation re-clones and shuffles that residual pack, then deals community_remaining / hole_remaining from it.

AUTHOR

Nathaniel Graham, <ngraham at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2016-2026 Nathaniel Graham.