Skip to lesson
Flawless Poker
Galaxy Bot AcademyBot Architecture and Artificial Intelligence
ADVANCED · 16 MIN READ · BOT ARCHITECTURE AND ARTIFICIAL INTELLIGENCE

Monte Carlo Equity Estimation

Learning objectiveDescribe a bounded simulation with valid hidden-card sampling.

Understand the idea

Monte Carlo simulation samples unseen opponent hands and remaining board cards, evaluates each complete showdown, and averages pot share. Exact enumeration considers all legal combinations and is more precise but may be slower. A random sample trades precision for speed; its uncertainty falls roughly with the square root of sample count.

Keep the simulation bounded so the adapter answers within 20 seconds. Remove all known cards, sample opponent holdings without replacement from a chosen range, finish the board, evaluate best five of seven, and count ties fractionally. A fixed seed makes tests repeatable. The pseudocode is a design outline, not a replacement for the site's engine.

At the poker table

If 600 of 2,000 sampled heads-up runouts win and 100 tie, estimated equity is (600 + 100/2)/2000 = 32.5%. This says nothing about unsampled opponent ranges.

Code and decision sketch

Pseudocode
wins = ties = 0
for trial in range(min(requested_trials, 2000)):
    unseen = deck - known_cards
    villain = sample_range_without_replacement(unseen)
    runout = sample_board_completion(unseen - villain, board)
    result = compare_best_five(hole + runout, villain + runout)
    wins += result == 'win'
    ties += result == 'tie'
equity = (wins + ties / 2) / trials  # heads-up only

Common mistake

Do not sample duplicate cards, treat ties as wins, or run unbounded trials while the turn deadline expires.

Try it yourself

Explain what changes when the opponent range is restricted to strong preflop hands.