Inspiration

Poker is a game of incomplete information against opponents who adapt, which makes it a good test of practical decision making under uncertainty. The AlgoSoc track adds hard engineering limits: 10 ms per decision and a 10 second time bank per 1,000 hands, in Python with the standard library only. I wanted to see how far a solo, evidence-driven bot could get against the other teams' bots.

What it does

Mohil'sPokerBot plays 6 to 8 handed no-limit Texas hold'em in the live AlgoSoc tournament. Each decision goes through four stages:

  • Preflop: lookup tables of hand equity against 1 to 7 opponents and against top-X% ranges, built offline and embedded in the file, combined with position-based opening ranges.
  • Opponent modelling: for every seat the bot tracks how often they play a hand, open by position, 3-bet, fold to 3-bets, call all-ins, bet, and fold to bets. Each statistic starts from a sensible prior, so hand 1 is sane, and adapts over the round. It uses these to narrow each opponent's likely range.
  • Postflop: Monte Carlo equity against those ranges, then an expected-value choice between checking, betting 1/2, 3/4 or a full pot, calling, raising or folding.
  • Time management: a budget model spreads the 10 s bank over the Agent's 1,000-hand lifetime, accounting for the server's per-decision overhead, with a cheap equity fallback if the bank runs short.

How I built it

Everything is in one Python file (bot.py) built from a template plus generated lookup tables. I built a local test harness on the official engine with clones of real opponents, fitted from their tournament statistics, and paired seeds so two versions see the same cards and tables.

The most useful tool was the real data. I pulled every hand our bot played from the tournament API and analysed it: chips won by position and street, how calls compared with folding, and how often opponents folded to bets of each size.

What the real hands taught me

  • The field over-folds, and we win without showdown. Most of our profit came from bets that made opponents fold. A stricter version that bet less and folded more lost about 20 bb/100 of that profit on real tables, so I rolled it back.
  • River bluffs below top pair were losing. Removing them was the best single change: the live bot made +26.9 bb/100 over 16,000 hands on Saturday.
  • Bet size changes fold rates, but bigger bets still lost. Across about 9,000 real bets, opponents folded more to bigger bets (40% to half pot vs 56% to pot on the flop). A version that bet pot-sized lost live, because it built huge pots with one pair. I rolled it back within the morning.
  • Big pots need big hands. On Sunday our losses came from one-pair hands in big pots (2 wins in 27). The live bot now folds weak pairs to big turn bets and folds top pair to passive players' big late bets, which were losing 5 to 21 big blinds per call.
  • Re-raise the players who over-fold. At our table one bot folded to re-raises 80% of the time (269 spots). Re-raising openers who fold that often won chips immediately, so the bot now re-raises them much more widely, measured per opponent within each round.

Challenges

  • The simulator lied in one direction. Its opponents paid off too often at showdown, so it overrated strict, value-heavy play. I ended up using it only to catch bugs, timing problems and regressions, and made strategy decisions from real hands.
  • Timing. A few decisions per round were timing out on the real server. I measured the server's overhead from real think-time data and built a budget model that keeps every decision well under 10 ms, tested over full 1,000-hand blocks.
  • Noise. One 1,000-hand round can swing by about 55 bb/100, so I only shipped changes backed by enough hands or a clear mechanism, and I dropped ideas that did not clear that bar (opponent fingerprinting, pot-sized river bluffs), and rolled back the ones that lost live.

Accomplishments that I'm proud of

Finishing Saturday's counted rounds 9th as a solo entry, with a bot whose every shipped change is backed by measured evidence rather than intuition.

What I learned

Measure before you change anything, trust real data over a convenient simulator, and treat engineering constraints like time limits as part of the strategy.

What's next

Value bets bigger than pot with very strong hands, position-specific exploits against tables that over-fold their blinds, and a properly calibrated simulator.

Built With

  • game-theory
  • monte-carlo
  • poker
  • python
Share this project:

Updates

Submission history