PokerPocket
Fast, deterministic Texas Hold'em reducer for JavaScript and TypeScript. Zero runtime dependencies, plug into any loop or UI.
โ Batteries-included CLI
โ Works offline, no deps
import {
advanceUntilDecision,
createTable,
getBoardAscii,
getSeed,
} from '@pokerpocket/engine'
const state = advanceUntilDecision(
createTable(6, 20000, 100, { seed: 42 })
)
console.log(getBoardAscii(state))
console.log(getSeed(state))
โ Bring your own transport/UI
โ Seed in, snapshot out
Interactive Playground
Drive the reducer, inspect hand evaluations, and feel the determinism of PokerPocket's engine.
Complete Hand Simulation
Hand Evaluator
Reducer Micro-Benchmark
Command Line Interface
The package ships with a zero-dependency CLI that wraps the same reducer powering the API.
๐ฏ Deterministic runs
Seed, serialize, and resume reducer state at any point.
๐ง Dev tooling
Introspect players, board, pots, and RNG snapshots live.
๐ Integration ready
Mirror the CLI flows when wiring bots, clients, or tests.
Integration Examples
Drop the reducer into different environments. Determinism makes tests and replay tooling effortless.
import {
advanceUntilDecision,
call,
check,
createTable,
getActionOptions,
isHandDone,
reduce,
} from '@pokerpocket/engine'
let state = advanceUntilDecision(createTable(3, 20000, 100))
while (!isHandDone(state)) {
const options = getActionOptions(state)
if (!options) break
const action = options.canCheck ? check(options.seat) : call(options.seat)
state = advanceUntilDecision(reduce(state, action))
}
console.log(state.tag) // "COMPLETE"
import {
advanceUntilDecision,
createTable,
reduce,
} from '@pokerpocket/engine'
const usePoker = (players = 6) => {
const [state, setState] = useState(() =>
advanceUntilDecision(createTable(players, 20000, 100))
)
const dispatch = useCallback(action => {
setState(prev => advanceUntilDecision(reduce(prev, action)))
}, [])
return { state, dispatch }
}
import {
advanceUntilDecision,
check,
createTable,
getActionOptions,
reduce,
} from '@pokerpocket/engine'
let state = advanceUntilDecision(createTable(3, 5000, 50, { seed: 9 }))
const options = getActionOptions(state)
if (options?.canCheck) {
state = advanceUntilDecision(reduce(state, check(options.seat)))
}
console.log(state.tag)
import { reduce } from '@pokerpocket/engine'
import type { Action, GameState } from '@pokerpocket/engine'
function apply(state: GameState, action: Action) {
return reduce(state, action)
}
Quick Start
Install the engine, run the CLI, or embed the reducer in your stack.
npm install @pokerpocket/engine
npx @pokerpocket/engine --seed 42