Skip to main content

Crate robopoker

Crate robopoker 

Source
Expand description

Poker solver toolkit for game-theoretically optimal strategies.

This facade re-exports the published robopoker library crates under convenient names. The private application and service crates (live-game coordination, HTTP server, training orchestration, benchmarking) are not re-exported here — depend on them directly from the workspace if you need them.

§Crate Organization

§Core

  • core — Type aliases, constants, action translation, shared traits
  • cards — Card primitives, hand evaluation, abstraction primitives
  • transport — Optimal transport (Sinkhorn, EMD)
  • clustering — Generic triangle-inequality-accelerated k-means
  • gameplay — Poker game engine
  • mccfr — Game-agnostic MCCFR framework
  • subgame — Safe + depth-limited subgame solving
  • nlhe — No-Limit Hold’em solver

§Infrastructure

  • database — PostgreSQL persistence
  • telemetry — OpenTelemetry init and metric registry

Re-exports§

pub use deuce as cards;
pub use elkan as clustering;
pub use kicker as gameplay;
pub use daybook as database;
pub use mccfr;
pub use monge as transport;
pub use nlhe;
pub use pokerkit as core;
pub use subgame;
pub use vitals as telemetry;

Macros§

hyperparams
Declare a process-global singleton for a hyperparameter struct.

Structs§

AivatDelta
AIVAT-adjusted aggregate: lean wire type with no embedded Summary.
AivatResult
AIVAT-adjusted result for a single hand.
Anchor
Opaque index into a crate::Lattice. Constructed only by the crate; callers receive these from crate::Lattice::bracket or Translation::resolve and pattern-match.
Bracket
A pair of bracketing anchors (lo, hi) from crate::Lattice::bracket.
Config
The three boolean axes that pick out one cell of the zoo.
ID
Generic ID wrapper providing compile-time type safety over uuid::Uuid.
Lattice
A non-empty, strictly ascending sequence of finite f64 anchors, each paired with a payload P, tagged with its Axis.
Scalar
A finite scalar observation tagged with its Axis.
Summary
Aggregate statistics over N played hands.

Enums§

Regime
Action abstraction regime controlling bet sizing grid and database table names.
Translated
Outcome of running a Translation policy against a crate::Lattice and a crate::Scalar.
Translation
Action-translation policy. Each variant names a canonical algorithm; resolve runs that algorithm against a Lattice and a Scalar to produce a Translated<P, F>.
Variant
Who’s playing — picked by the user (UI), CLI (slumbot), or the hosting backend. The cube IS the identity; the label and UUID are derived from the axis triple.
Version
Abstraction version controlling clustering parameters and table names.

Constants§

ASYMMETRIC_UTILITY
Asymmetric payoff for RPS test game (rock beats scissors by 2x).
B_BLIND
Big blind amount.
EPSILON
Minimum policy weight to prevent division by zero in normalization.
FRONTIER_LEAVES
Number of biased continuation strategies at depth-limited frontiers. D=4: unmodified blueprint + fold-biased + call-biased + raise-biased (Pluribus).
KMEANS_EQTY_CLUSTER_COUNT
Equity histogram resolution (0%, 1%, …, 100%).
KMEANS_FLOP_CLUSTER_COUNT
Number of flop buckets (distributions over turn clusters).
KMEANS_MAX_CLUSTER_COUNT
Maximum clusters per street. Bound by Abstraction’s 8-bit index field (0..=255 = 256 distinct values).
KMEANS_TURN_CLUSTER_COUNT
Number of turn buckets (distributions over river equity).
MAX_IDLE_HANDS
Maximum consecutive all-timeout hands before ending session.
MAX_PATH_EDGES
Maximum edges in a packed Path (12 nibbles × 5 bits = 60 bits ≤ 64 bits). Data-representation limit, not a solver depth knob — the subgame tree’s effective depth is controlled by where DepthGame::at_frontier fires (first chance node past origin), not by this constant.
MAX_RAISE_REPEATS
Maximum re-raises per betting round (limits tree width).
N
Number of players at the table.
N_WORLDS
Alternative opponent hand partitions in the subgame (safe subgame solving). Each world represents a partition of the opponent’s range conditioned on the observed action sequence. More worlds = finer range partitioning = more robust strategy, but higher memory and slower convergence.
OPENS
Preflop open sizes in BB units (depth=0 only).
PACE_BOT_THINK
Simulated think time for bot actions.
PACE_DEAL_BOARD
Delay after dealing community cards.
PACE_DEAL_HOLE
Delay after hand start before dealing hole cards.
PACE_DECISION
Timeout for human player decisions.
PACE_RESULTS
Pause between hands (after settlement, before next deal).
PACE_ROOM_STARTUP
Timeout for room startup (waiting for WebSocket connection).
PACE_SHOWDOWN
Window for voluntary card reveals at showdown.
PLURIBUS_INDICES
Action grid for the Pluribus regime. Pluribus-faithful (Brown & Sandholm 2019) widths on first-bet rows, shrunk on subsequent raises. No SPR axis on the menu — pot-relative sizing already self-scales with stack depth (1× pot at SPR=1 is all-in), so the menu is keyed only on (street, depth). All-in remains available at every node as Edge::Shove.
RAISES
Canonical raise pool as pot-relative (numerator, denominator) fractions. Index position = u8 encoding offset from 10. 1:1 with Odds::GRID. 0 1 2 3 4 5 6 7 8 9 25% 33% 50% 67% 75% 100% 125% 150% 200% 300%
SLUMBOT_INDICES
STACK
Starting stack size in chips.
S_BLIND
Small blind amount.
VARIANT_NAMESPACE
Namespace UUID v5 for deterministic bot identity. Combined with the bot:<label> username, gives every cube cell + fish a stable UUID independent of the build (server, slumbot, client).

Traits§

Arbitrary
Random instance generation for testing and Monte Carlo sampling.
Axis
Marker for a scalar axis. Implementors are typically zero-sized structs like BB, PotFraction, BidAmount. Values along the axis are assumed non-negative.
Unique
Unique identifier trait for domain entities.

Functions§

brb
Register graceful interrupt handler. Type “Q” + Enter to stop after current batch. Also handles SIGTERM (sent by ECS stop-task) for graceful remote shutdown. Optionally set TRAIN_DURATION env var (e.g., “2h”, “30m”) for timed runs.
config_string
Compact textual fingerprint of every constant that defines the game tree shape for this regime. Two trainers producing the same fingerprint can safely share the same blueprint_<regime>_<version> table; two that don’t would silently corrupt each other’s strategy data — InfoIds keyed by Edge::Raise(Size) carry the same byte representation but mean different actions when the underlying Size lattice shifts.
erf
Approximate standard normal CDF using the Abramowitz & Stegun formula.
init_regime
Sets the active regime. Must be called before any sizing or table access. Panics if called twice with different values.
init_translation
Sets the active translation. Must be called before any inference path queries it. Panics if called twice with different values.
init_version
Sets the active version. Must be called before any table access. Panics if called twice with different values.
interrupted
Check if graceful shutdown was requested (via stdin “Q”) or deadline reached.
kys
Register Ctrl+C handler for immediate (non-graceful) termination. Use when you need hard shutdown without waiting for current batch.
ratio
regime
Returns the active regime. Defaults to Pluribus if init_regime was never called. Binaries should still require explicit --regime via clap.
slumbot_opponent_username
The slumbot.com adversary identity, recorded as a fixed pseudo-bot when the slumbot crate persists hands. Not in the zoo; the slumbot binary plays our zoo bots against this external opponent.
slumbot_opponent_uuid
translation
Returns the active translation. Defaults to Snap if init_translation was never called. Binaries should require explicit --translation via clap.
version
Returns the active version. Defaults to V3.

Type Aliases§

Chips
Stack sizes and bet amounts in big blinds.
Energy
Distance metrics, convergence thresholds, and smoothing terms.
Entropy
Temperature parameters and information-theoretic measures.
Epoch
Training iteration counter for CFR epochs.
Position
Seat index around the table (0 = button in heads-up).
Probability
Strategy weights, sampling distributions, and reach probabilities.
Utility
Expected values, regrets, and payoffs.