The beating heart, extracted: a pure hold'em state machine, the trained brain that plays it near-unexploitably, and the rigs that keep everyone honest. No DOM, no network, no server — every module runs in node and in the browser, and every hand replays from a 64-hex seed.
The game — poker.js: complete no-limit and fixed-limit Texas
hold'em — side pots, min-raise law, deterministic Fisher–Yates shuffles
from committed seeds, tournaments, hand evaluation. Pure and
serializable; the log is the truth.
The brain — a heads-up fixed-limit strategy in three parts:
strategy-hulimit.json— the champion table: CFR-trained postflop with Cepheus's solved preflop grafted on (graft-cepheus.js); abstraction inladder.js(exact-169 preflop, bucketed streets;equity-buckets.jsadds E[HS²] percentile buckets).river-solver.js— the abstraction retires on the river: range tracking through the hand, then an exact range-vs-range subgame solve in ~100ms, including per-action EVs (riverEvs) — the leak meter's ground truth.rating.js— Glicko-2, verified against Glickman's worked example.
The training — cfr.js + train.js (Kuhn and Leduc gates: exact
values, exploitability bounds), train-holdem.js (external-sampling
MCCFR with RM+ and linear averaging), build-buckets.js (quantile
edges).
The rigs — nothing ships on faith:
tests.js,river-tests.js— engine law and solver semantics (equal-EV at equilibrium to the decimal; fold EV = −pot/2 exactly).lbr.js— Local Best Response (Lisý & Bowling 2017): a lower bound on exploitability. The champion measures ≈ 0 with the river solver armed.ab-tables.js— table-vs-table head-to-head;eval.js— versus the character bots (bots.js);cepheus-compare.js— divergence from the solved preflop.
Extracted verbatim from the Wardroom (tide-games), where this code was
built and battle-tested hand by hand; the room remains the reference
consumer until play replaces it. RATINGS.md — the Ledger design
(chains, transcripts, anchors) — travels with the engine it will
instrument. Records conform to
libre-poker/schema.
AGPL-3.0 — see LICENSE. The schema this engine speaks is CC0; the split is deliberate.