PokerBotRe is a Python research project for decision-making in no-limit hold'em under hidden information. Its active strategy combines action-based Bayesian opponent ranging, range-weighted Monte Carlo equity estimation, and a rule-based betting policy. It also includes a browser-driven PokerNow runner; use that component only where automated play is explicitly permitted.
On every table update, the project:
-
Scrapes public cards, stacks, bets, player status, and available actions.
-
Detects newly observed opponent actions.
-
Maintains a probability distribution over each opponent's legal hole-card combinations. New hands start from a uniform legal-combo prior.
-
Updates an opponent range with Bayes' rule after an observed action:
P(combo | action, context) ∝ P(action | combo, context) × P(combo)The likelihood is produced by a CatBoost action model. Preflop and postflop use separately trained models.
-
When hero acts, samples 1,000 compatible opponent hands and board runouts from the current posterior ranges to estimate showdown equity.
-
Selects fold, check, call, or a sized raise from that equity, pot odds, and public action history.
The live policy is in models/RangingEquityBot.py:
- High equity: raise if possible; otherwise call when facing a bet or check when action is free. The high-equity thresholds are 0.74 when facing a bet and 0.63 when action is free.
- Medium equity: call only when equity clears pot odds; otherwise fold when facing a bet or check when action is free.
- Low equity: check when free and fold when facing a bet.
- Value raise sizes are selected from min-raise, half-pot, three-quarter-pot, and pot presets according to equity and street.
- Bluffs are deliberately constrained: hero equity must be at least 0.375, the hand must be sufficiently short-handed, all active opponent range means must be below 0.35, no active opponent may have raised, gone all-in, or called more than 1bb, a raise must be legal, and a 50% random gate must pass.
The project does not currently include an MCCFR/CFR solver or an offline MCCFR matchup harness. Earlier documentation for those removed components has been deleted.
GameManager.py Live table orchestration, overlay, and UI actions
PokerState.py Table state, event detection, Monte Carlo, hand evaluator
RunOnline.py Live runner entry point
models/RangingModel.py CatBoost action models and Bayesian range tracker
models/RangingEquityBot.py 1,000-sample equity policy and bluff guardrails
models/EquityModel.py Keras equity estimator used for diagnostics/features
data/InterpretTrainingData.py Raw hand-history to training-row conversion
training/TrainRangingModel.py Shared CatBoost training implementation
testing/PlayCatBoostSimulator.py Offline four-player CatBoost simulator
testing/TestRangingEquityBot.py Unit tests for the current action policy
.\.venv\Scripts\pip.exe install PokerNow undetected-chromedriver setuptools catboostInstall keras and tensorflow as well when using models/EquityModel.py or
when generating training features with Keras equity enabled:
.\.venv\Scripts\pip.exe install keras tensorflowsetuptools is needed on Python 3.12+ because undetected-chromedriver still
imports distutils.
Place raw PokerNow JSON and/or Kaggle/Holdem Manager hand histories below
data/raw/, then create interpreted action rows:
.\.venv\Scripts\python.exe data\InterpretTrainingData.pyFor a faster conversion that skips the Keras-derived feature:
.\.venv\Scripts\python.exe data\InterpretTrainingData.py --skip-keras-equityTrain the separate action-likelihood models:
.\.venv\Scripts\python.exe training\TrainPreflopRangingModel.py
.\.venv\Scripts\python.exe training\TrainPostflopRangingModel.pyThe trained artifacts are written to:
models/preflop_ranging_action_model.cbm
models/preflop_ranging_action_model_metadata.json
models/postflop_ranging_action_model.cbm
models/postflop_ranging_action_model_metadata.json
For a small training smoke run:
.\.venv\Scripts\python.exe training\TrainPreflopRangingModel.py --max-rows 5000 --iterations 50
.\.venv\Scripts\python.exe training\TrainPostflopRangingModel.py --max-rows 5000 --iterations 50Run policy tests without opening a browser or loading CatBoost/Keras models:
.\.venv\Scripts\python.exe testing\TestRangingEquityBot.pyRun the existing offline CatBoost simulator:
.\.venv\Scripts\python.exe testing\PlayCatBoostSimulator.py --hands 10Configure the table hero name, then start the runner:
$env:POKERBOT_HERO_NAME = 'your_player_name'
.\.venv\Scripts\python.exe RunOnline.pyThe runner reads the installed Chrome major version from the Windows registry and requests a matching ChromeDriver. If detection is unavailable, explicitly set the major version before starting it, for example:
$env:POKERBOT_CHROME_MAJOR = '151'The live loop logs the bot decision in this form:
raise half pot - e=0.766 | r_avg=0.485 | r_high=0.485 | high equity value
e is the 1,000-sample range-aware hero equity. r_avg is the mean of the
active opponents' range-equity means; r_high is the highest such mean. These
two fields are range summaries, not direct opponent-card observations.