How the Texas Hold'em AI Works: Monte-Carlo Equity and Pot Odds
How the Texas Hold'em AI works: it estimates its equity by Monte-Carlo simulation and weighs that against pot odds to decide whether to fold, call, bet or raise.
The opponent on LK Forge Texas Hold'em plays heads-up No-Limit poker — and it cannot see your two hole cards. Poker is a hidden-information game, so the engine can't compute a single right answer. Instead it does what a strong human does, only faster and exhaustively: it works out how often it wins, and bets accordingly.
Estimate equity by Monte-Carlo
The engine knows its own two cards and whatever community cards are showing. Everything else — your two cards and the board still to come — it deals out many plausible ways. For each of those completed boards it runs both hands to showdown through a fast 5-of-7 evaluator (the best five-card hand from the seven available) and records who won. The share of those thousands of showdowns it takes down is its equity: the probability it currently holds the best hand.
Equity is just a counted win rate over sampled showdowns. There are 2,598,960 distinct five-card hands, so exact enumeration every street is wasteful — sampling gets a stable estimate fast.
// Monte-Carlo equity estimate (schematic) function equity(myCards, board) { let wins = 0; for (let s = 0; s < SAMPLES; s++) { const { villain, fullBoard } = dealUnknown(myCards, board, rng); const me = best5of7(myCards, fullBoard); const opp = best5of7(villain, fullBoard); if (me > opp) wins++; // ties count as half elsewhere } return wins / SAMPLES; // probability we hold the best hand }
From equity to a decision
Equity alone isn't a move — it has to be weighed against the price. The engine compares its win probability to the pot odds (the cost to call versus what's in the pot): if equity beats the price, calling or raising is profitable; if not, it folds. It sizes bets by how strong it is, and deliberately mixes in a capped share of bluffs so a good opponent can't simply fold every time it bets. That last piece matters — a purely value-only bot is exploitable precisely because it never bluffs.
That is the whole engine: sample the unknown cards, rank each showdown with a fast evaluator to get equity, then act on equity versus pot odds with a dash of bluff. Curious how sampling-based card AI holds up under measurement? Read our study of a Monte-Carlo card engine, or why our games are search, not chatbots, in Real Game AI, Not a Chatbot.
FAQ
How does the poker AI decide to fold, call or raise?
The poker AI decides by estimating its equity via Monte-Carlo — dealing your unknown cards and the remaining board many ways, playing each to showdown with a fast hand evaluator, and counting how often it wins. It compares that win probability with the pot odds it is offered, sizes its bets by strength, and mixes in a capped share of bluffs so it stays unpredictable. That mix of value bets and occasional bluffs is what keeps a good opponent from simply folding every time it bets.
Can the AI see my hole cards?
No — the AI cannot see your hole cards. Poker is a hidden-information game, so it treats your cards as unknown. It samples them, along with the cards still to come, many plausible ways, which is exactly why it has to reason about probability rather than certainty.
What are pot odds and how does the AI use them?
Pot odds are the price of a call: the amount to call versus the size of the pot you would win. The AI calls or raises when its Monte-Carlo equity beats that price and folds when it doesn't — the same break-even reasoning a solid human uses, just computed from thousands of sampled showdowns. This comparison is recalculated on every street as new community cards change both its equity and the size of the pot.
Is there real money?
No real money is involved — this is heads-up No-Limit Texas Hold'em with play chips only, nothing to buy, and a persistent chip stack that lives in your browser. Your stack is simply a running score, not currency, so there is nothing to win or lose beyond the game itself. It is a solid, honest opponent, not a perfect solver.
Sit down heads-up — play chips only.
Play Texas Hold'em →