This repository contains Fold_Master, my bot implementation for the IIT Pokerbots competition playing Sneak Peek hold'em. It is built on top of the official IIT Pokerbots reference engine.
Fold_Master is a highly optimized, equity-driven bot that relies on fast simulations, dynamic opponent profiling, and adaptive risk management to make decisions.
- Fast Bitwise Evaluation: To support high-volume Monte Carlo simulations within the time limits, the bot uses a highly optimized, custom bit-manipulation approach (
_make_partial,_rank_fast) to evaluate hand strengths instantly. - Range-Based Simulation: Instead of assuming the opponent holds random cards, Fold_Master assigns weights to potential opponent hands based on board texture (Nut, Strong, Medium, Weak, Draw, Air) and inferred betting signals.
- Preflop: Utilizes a hardcoded, pre-computed equity table. It applies positional and action-specific thresholds (e.g., reacting differently to SB opens vs. 3-bets vs. BB limps) to determine whether to fold, call, or raise.
- Postflop (Flop & Turn): Runs Monte Carlo rollouts against the opponent's modeled range to estimate expected equity.
- River: Switches from Monte Carlo to Exact Enumeration for absolute precision. If the auction was won, it calculates a pure dominance percentile. It also includes "massive pot brakes" to prevent over-committing without the absolute nuts when the pot grows exponentially.
- EV-Scaled Bidding: Bids are calculated based on preflop hand equity. The bot bids low with absolute trash (no potential) and the absolute nuts (doesn't need the extra card), peaking its bids for strong/middling hands that benefit most from a 3rd hole card.
- Adaptive Capping: It tracks the opponent's historical average bid (
opp_avg_bid) to ensure it only pays exactly what is needed to win the auction, capping bids to prevent overspending.
- Bayesian Tracking: Smooths out early-game volatility by using Bayesian tracking for the opponent's VPIP (Voluntarily Put In Pot) and Overbet Frequency.
- Action Signals: Categorizes opponent bet sizings into 'ultra_polar', 'polar', 'linear', or 'passive' signals, automatically adjusting the weights of the hands the opponent is likely holding.
- Hero-Call Prevention: Includes strict overbet defense logic (MDF fold thresholds) to auto-fold marginal hands against aggressive betting ratios, preserving stack depth.
- Leverage Penalties: Adjusts the required equity to call based on the "leverage" (the ratio of the pot to the remaining stack), avoiding high-variance flips with marginal advantages.
To ensure the bot runs correctly with the engine, the following folder structure is maintained. The core logic of my bot resides entirely in bot.py.
.
├── bot.py # Fold_Master implementation and decision logic
├── pkbot/ # Game engine package (unmodified)
├── config.py # Configuration for local testing matches
├── engine.py # The game engine executable
└── requirements.txt # Python dependencies
Note: The pkbot package has not been modified, and the import statements in bot.py rely on it being located in the same directory.
-
Documentation For a detailed guide on the underlying engine API, available classes, methods, and base game logic, please refer to the official
BOT_GUIDE.md. -
How to Run & Test Locally You can test this bot against other implementations (or itself) using the included engine.
-
Install Dependencies: Make sure you have Python 3 installed, then run:
Bash
pip install -r requirements.txt
Configure the Match:
Edit config.py to specify which bots to run. To test my bot, ensure at least one player path points to bot.py.
Start the Engine: Execute the engine script from the root directory:
Bash
python engine.py
This will launch the game engine and spawn two instances of the bots defined in config.py. For more info visit official repo : https://github.com/iitpokerbots/bot-engine-2026