Poker bots built from scratch using Counterfactual Regret Minimization (CFR), the algorithm family behind the AI systems that beat top human professionals at heads-up poker (Libratus, Pluribus).
Two solvers per game: vanilla CFR (full game-tree traversal every
iteration) and external-sampling MCCFR (samples opponent/chance
actions instead of fully exploring them, trading per-iteration accuracy
for far cheaper iterations). See BENCHMARKS.md for a head-to-head
comparison.
Two games implemented:
- Kuhn Poker (3 cards, 1 betting round) -- has a known, published closed-form Nash equilibrium value, used here to prove the implementation is actually correct. The trained strategy converges to a game value of -0.0555, matching the theoretical -1/18 to within 0.0001.
- Leduc Hold'em (6 cards, 2 betting rounds with raises, a community card) -- the standard benchmark game used in CFR research papers. No closed-form answer exists, so correctness is verified by independent brute-force re-evaluation of the converged strategy against the training-tracked value.
Open play.html in any browser. Pick Kuhn or Leduc from the tabs, play hands against the trained bot, and watch its mixed-strategy probabilities at each decision point.
python3 kuhn_cfr.py
python3 kuhn_mccfr.py
python3 leduc_cfr.py
python3 leduc_mccfr.py
python3 test_kuhn_cfr.py
python3 test_kuhn_mccfr.py
python3 test_leduc_game.py
python3 test_leduc_cfr.py
python3 test_leduc_mccfr.py
kuhn_cfr.py/leduc_cfr.py-- the CFR solversleduc_game.py-- Leduc Hold'em rules (betting, raises, hand evaluation)test_*.py-- verification suitesplay.html-- interactive browser demo with trained strategies embeddedstrategies.json-- exported trained strategies (source data for the demo)