Back to Field Notes

Entry No. 03 · Game theory · Solver

Kuhn Poker Solver

A Nash equilibrium solver whose every claim can be checked against a closed-form answer.

Counterfactual Regret Minimization applied to Kuhn poker, with an exact exploitability measurement and a dashboard for watching an equilibrium converge, playing against it, and being coached on every decision. Kuhn poker was chosen for one reason: its Nash equilibria are known in closed form, which turns every result into something checkable against ground truth rather than against a previous run.

What I built

  • CFR+ reaches 1.23 × 10⁻⁶ chips per hand of exploitability at 250K iterations, 363× lower than vanilla CFR, and recovers the exact game value of −1/18.
  • The TypeScript port runs 100,000 iterations in the browser in 0.46 seconds, about 14× faster than the Python reference it was ported from. Both are re-derived and compared on every push.
  • Duplicate-scored matches against seven rule-based opponents, with exact expected value by enumeration and win rates over 200K simulated hands.
  • 47 passing tests.

Made with

  • TypeScript
  • Python
  • Next.js
  • CFR+

Where to find it