Skip to content
PokerML preflop range matrix and decision tree

PokerML

Updated Nov 2025

PythonFastAPIphevaluatorCFR+

this is a heads-up no-limit hold'em solver built on CFR+ and external sampling monte carlo. it trains over 100K iterations with k-means preflop bucketing and percentile-based postflop abstraction, then serves the converged strategy through a fastapi web app where you can play against the bot and see its 13x13 range grid in real time.

CFR+ with external sampling: 100K iterations, regret clamping, bucket-cached traversal across all 4 streets

k-means preflop abstraction (10 buckets) + empirical CDF postflop bucketing with sampled board completions

fastapi web UI where you play against the bot with a live 13x13 range heatmap showing action probabilities per hand

what i built

  • CFR+ trainer with external sampling MCCFR, immutable game states, and per-iteration bucket caching for speed
  • two-level card abstraction: k-means on preflop equity (169 hands to 10 buckets) and percentile CDF on postflop hand strength
  • action abstraction with 50% and 100% pot bet sizings, fold/check/call, all-in, and a 4-raise-per-street cap
  • fastapi server with session management, bot inference, and a 13x13 range grid API for the frontend

how it works

  1. 1deal hands and board, pre-cache card buckets for both players across all 4 streets
  2. 2traverse the game tree: enumerate all actions for the traversing player, sample one for the opponent
  3. 3update cumulative regrets (clamped to zero for CFR+) and accumulate strategy sums
  4. 4after 100K iterations, compress the averaged strategy to JSON and serve it via fastapi for live play

results

  • converged strategy across ~1,173 lines of python with an 18.5 MB compressed strategy file
  • interactive web UI where you can play full hands and inspect the bot's action distribution for any of 169 canonical hands

what's next

  • add variance reduction techniques like pruning and warm starting
  • expand action abstraction with more bet sizings and raise depths