Skip to content

Repository files navigation

regretless

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.

Play against it

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.

Run the solvers

python3 kuhn_cfr.py
python3 kuhn_mccfr.py
python3 leduc_cfr.py
python3 leduc_mccfr.py

Run the tests

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

Files

  • kuhn_cfr.py / leduc_cfr.py -- the CFR solvers
  • leduc_game.py -- Leduc Hold'em rules (betting, raises, hand evaluation)
  • test_*.py -- verification suites
  • play.html -- interactive browser demo with trained strategies embedded
  • strategies.json -- exported trained strategies (source data for the demo)

About

Poker bots trained via Counterfactual Regret Minimization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages