Skip to main content

Crate rbp

Crate rbp 

Source
Expand description

Poker solver toolkit for game-theoretically optimal strategies.

This facade crate re-exports all public rbp crates for convenient access.

§Crate Organization

§Core Types

  • core — Type aliases, constants, DTOs, and shared traits
  • transport — Optimal transport (Sinkhorn, EMD)
  • cards — Card primitives and hand evaluation
  • mccfr — Game-agnostic CFR framework

§Domain Logic

§Infrastructure

§Application

  • gameroom — Async game coordinator with player implementations and records
  • server — Unified backend with analysis API and WebSocket hosting
  • autotrain — Training orchestration with distributed workers

Re-exports§

pub use rbp_core as core;
pub use rbp_transport as transport;
pub use rbp_cards as cards;
pub use rbp_mccfr as mccfr;
pub use rbp_gameplay as gameplay;
pub use rbp_clustering as clustering;
pub use rbp_nlhe as nlhe;
pub use rbp_database as database;
pub use rbp_auth as auth;
pub use rbp_gameroom as gameroom;
pub use rbp_server as server;
pub use rbp_autotrain as autotrain;

Modules§

dto
Data transfer objects for API communication.

Structs§

AbsHist
ApiDecision
ApiSample
ApiStrategy
GetPolicy
ID
Generic ID wrapper providing compile-time type safety over uuid::Uuid.
ObsHist
ReplaceAbs
ReplaceAll
ReplaceObs
ReplaceOne
ReplaceRow
RowWrtObs
SetStreets

Constants§

ASYMMETRIC_UTILITY
Asymmetric payoff for RPS test game (rock beats scissors by 2x).
BIAS_FOLDS
Initial regret weight for fold actions (high = fold more often early).
BIAS_OTHER
Initial regret weight for call/check actions (baseline).
BIAS_RAISE
Initial regret weight for raise actions (low = raise less often early).
B_BLIND
Big blind amount.
CFR_BATCH_SIZE_NLHE
Trees sampled per NLHE iteration (parallelized across threads).
CFR_BATCH_SIZE_RIVER
Trees sampled per river-only iteration (testing/debugging).
CFR_BATCH_SIZE_RPS
Trees sampled per RPS iteration.
CFR_TREE_COUNT_NLHE
Total NLHE training budget (~268M trees for production).
CFR_TREE_COUNT_RIVER
River-only training budget (~65K trees).
CFR_TREE_COUNT_RPS
Total RPS training budget (small game converges fast).
KMEANS_EQTY_CLUSTER_COUNT
Equity histogram resolution (0%, 1%, …, 100%).
KMEANS_FLOP_CLUSTER_COUNT
Number of flop buckets (distributions over turn clusters).
KMEANS_FLOP_TRAINING_ITERATIONS
Lloyd’s algorithm iterations for flop clustering.
KMEANS_TURN_CLUSTER_COUNT
Number of turn buckets (distributions over river equity).
KMEANS_TURN_TRAINING_ITERATIONS
Lloyd’s algorithm iterations for turn clustering.
MAX_DEPTH_ALLGAME
Maximum tree depth for full game abstraction.
MAX_DEPTH_SUBGAME
Maximum tree depth for real-time subgame solving.
MAX_RAISE_REPEATS
Maximum re-raises per betting round (limits tree width).
N
Number of players at the table.
POLICY_MIN
Minimum policy weight to prevent division by zero in normalization.
PRUNING_EXPLORE
Probability of sampling pruned actions anyway (prevents permanent lock-out).
PRUNING_THRESHOLD
Actions with regret below this are candidates for pruning (-300k ≈ 3× max pot).
PRUNING_WARMUP
Warm-up epochs before pruning activates (let regrets stabilize first).
REGRET_MIN
Floor for cumulative regret storage (prevents unbounded negative growth).
SAMPLING_CURIOSITY
Epsilon (ε) - minimum sampling probability floor. Ensures every action retains at least ε probability for exploration.
SAMPLING_SMOOTHING
Smoothing (β) - pseudocount added to numerator and denominator. Higher values pull sampling toward uniform (maximum entropy prior).
SAMPLING_TEMPERATURE
Temperature (T) - controls sampling entropy via policy scaling. Higher T → more uniform (exploratory); lower T → more peaked (greedy). Formula: σ’(a) = max(ε, (σ(a)/T + β) / (Σσ + β)).
SHOWDOWN_TIMEOUT
Timeout for voluntary card reveal at showdown (seconds).
SINKHORN_ITERATIONS
Maximum Sinkhorn-Knopp iterations before stopping.
SINKHORN_TEMPERATURE
Entropy regularization strength. Lower = closer to true EMD, higher = faster convergence.
SINKHORN_TOLERANCE
Early stopping threshold on marginal constraint violation.
STACK
Starting stack size in big blinds.
SUBGAME_ALTS
Alternative hands in the gadget game (Pluribus uses 4).
SUBGAME_ITERATIONS
CFR iterations for real-time subgame refinement.
S_BLIND
Small blind amount.
TRAINING_LOG_INTERVAL
Interval between progress log messages during training.

Traits§

Arbitrary
Random instance generation for testing and Monte Carlo sampling.
Unique
Unique identifier trait for domain entities.

Functions§

brb
Register graceful interrupt handler. Type “Q” + Enter to stop after current batch. Optionally set TRAIN_DURATION env var (e.g., “2h”, “30m”) for timed runs.
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.
log
Initialize dual logging (terminal + file) with timestamped log files. Creates logs/ directory and writes DEBUG level to file, INFO to terminal.

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.