Each CPU now thinks with one of four engines, each backed by a different
published library (pinned versions):
- montecarlo (@pokertools/evaluator): the existing balanced Monte Carlo
equity player, moved to server/bots/montecarlo.js.
- calculator (poker-calculations): the library's decideAction over the
table state; push/fold below 12BB via its jam breakeven equity.
Skipped automatically if the native addon cannot load.
- range (poker-utils): tight player; preflop by hand-strength percentile,
postflop equity vs an estimated opponent range, bluffs only when
alpha/bluffEV say they pay.
- madehand (pokersolver): loose, sticky player that only looks at the
made hand and draws.
server/ai.js assigns a mix of engines per table (makeStyles), falls back
to the Monte Carlo engine on errors, and legalizes every decision.
The engine and its parameters stay server-side; players cannot tell
which library a CPU uses. Tests cover every engine and the no-leak rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-rolled betting rules, side pots, showdown and hand
evaluator with the published @pokertools/engine and @pokertools/evaluator
libraries (MIT, pinned to 2.1.0).
- server/hand.js now wraps a PokerEngine per hand: it maps seats,
mirrors stacks, staggers the all-in runout, and pays host-chosen
winners on cash-only tables.
- server/cards.js and server/ai.js use the library evaluator.
- Out-of-turn folds go through the engine's stand; all-in hands stay
live when the player leaves; uncalled bets return to a leaver.
- The engine refuses some check-able folds that would leave a side pot
without eligible players; those now return a message (or check for
a leaving player) instead of crashing.
- BB must be greater than SB (engine requirement); Node >= 24.
- Tests rig cards via engine snapshots and cover the new edge cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Hand engine (server/hand.js): crypto-shuffled deck kept server-side,
blinds (heads-up button = SB), min-raise rules incl. incomplete all-in,
uncalled bet refunds, side pots, split pots, all-in runout
- Hand evaluator (server/cards.js) and node:test suite (npm test)
- Table flow: hands auto-continue after host START, 30s action clock
(timeout = check/fold + sit out), sit out / sit in, rebuy, mid-hand leave
folds and keeps the seat reserved until the hand ends, pause freezes all clocks
- Only each player's own hole cards are sent until a showdown/runout reveal;
all actions validated server-side
- Play UI: board, hole cards, bets, action tags, turn timer, raise panel with
presets, showdown results with winning cards highlighted, compact 7+ layout
- Remove the host crown and the temporary "next phase" control
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>