NAME

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

VERSION

0.11

SYNOPSIS

Preferred interface -- named games:

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

my $game = Poker::Game::Holdem->new( iterations => 1000 );
my $hero    = $game->deal_hole(['As', 'Kd']);
my $villain = $game->deal_hole(['7h', '7c']);

$game->flop(['Ah', 'Kc', '2d']);
$game->turn('9s');
$game->river('3c');

$game->evaluate($hero);
say $hero->name;          # Two Pair
say $hero->score;         # numerical strength
say $hero->best_combo_flat;

$game->reset;
$hero    = $game->deal_hole(['As', 'Kd']);
$villain = $game->deal_hole(['7h', '7c']);
$game->equity([ $hero, $villain ]);
say $hero->ev;

Advanced -- compose rules and scoring yourself:

use Poker::Eval::Omaha;
use Poker::Score::High;

my $ev = Poker::Eval::Omaha->new(
  scorer => Poker::Score::High->new,
  community_remaining => 2,
);

DESCRIPTION

Poker::Game::* modules are the primary API (Hold'em, Omaha, draw, stud, Badugi, etc.). They wire hole/board counts to the correct Poker::Eval and Poker::Score engines.

Poker::Eval remains the rules engine base class (how hole and community cards combine). Poker::Score defines ranking systems (highball, lowball, Badugi, ...).

Only this module defines $VERSION for the distribution; other packages intentionally omit it so PAUSE indexes a single release.

SEE ALSO

Poker::Game::Holdem, Poker::Game::Omaha, Poker::Game::FiveCardDraw, Poker::Game::SevenCardStud, Poker::Game::Badugi, Poker::Score, Poker::Dealer

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.