crtdrops
NOTE · ENGLISH ·

When two poker calculators disagree

On the left, a thousand simulations of 1,000 hands of 8♠8♥ against A♦K♣, each with a different seed: bars for how many landed in each half point of equity, from 50 % to 60 %, around a vertical line at the exact equity, 55.57 %. On the right: exact, over 1,712,304 boards, 55.57 %; 1,000 hands with seed 1, 54.80 %; 95 % margin, ± 3.09; inside the margin, 952 of 1,000.

Put a pair of eights against ace-king into two poker calculators and they may not give you the same number. Before deciding that one of them is wrong, it is worth asking what each one computed.

With the code of the calculator that comes with this note I got five numbers for that same hand, before the flop: 55.57 %, 54.80 %, 69.16 %, 31.66 % and 55.94 %. Four are correct: two answer the same question in different ways and two answer different questions. The fifth comes from a bug that hides well.

This is the math of the game, not an invitation to gamble. Every figure comes from the calculator’s code and was checked against an evaluator written separately; the simulated ones say how many hands and which seed, so you can repeat them.

What equity is

Equity is the share of the pot that is yours on average if every card is dealt and nobody folds. If your hand wins alone, you take the whole pot; if you tie with another player, half; if three tie, a third each.

It is not the same as the probability of winning. Equity counts ties as a share of the pot; “wins” does not count them.

The exact count

The example is 8♠8♥ against A♦K♣, before the flop. The four cards are known, 48 are left in the deck and the board is 5 of them: 1,712,304 possible boards. For a computer that is not many: the calculator’s code goes through all of them in 0.3 s on my Mac, and on each one it sees which hand wins.

The pair wins on 55.42 % of the boards, ties on 0.30 % and loses on 44.28 %. Its equity, with ties split in half, is 55.57 %. That is the exact number: it has no margin of error, because it was not estimated.

Holding a pair helps, but it does not decide: ace-king takes 44.43 % of the pot. And the count depends on the actual cards, not just on “pair vs. two high cards.” If the ace and king are suited, A♦K♦, they have more possible flushes and the pair drops to 52.29 %. If they share suits with the eights, A♠K♥, it lands at 54.75 %.

Monte Carlo: deal and count

Going through every board is not always possible. The alternative, the one many calculators use, is to deal at random many times and count: the Monte Carlo method. With 1,000 simulated hands and seed 1, the pair comes out at 54.80 %, 0.77 points below the exact figure.

Not matching is not a mistake: it is what happens with a sample. What you need is to know how far it can move, and that has a formula. The 95 % margin is 1.96 times the standard error, and the standard error shrinks with the square root of the number of hands. With 1,000 hands the margin is ± 3.09 points: the honest result is not “54.80 %” but “between 51.71 and 57.89 %.”

Simulated hands Pair’s equity Margin (95 %) Time
1,000 54.80 % ± 3.09 under 1 ms
10,000 55.83 % ± 0.97 6 ms
100,000 55.55 % ± 0.31 59 ms
1,000,000 55.57 % ± 0.10 578 ms
Exact, 1,712,304 boards 55.57 % — 295 ms

Every simulation in the table uses seed 1. The times are the median of seven runs of the same code with Node, on my Mac; in the browser they are of the same order, but vary more.

Four times as many hands only cut the margin in half. In the worst case, with 50 % equity, landing within ± 1 point takes 9,604 hands; within ± 0.1, 960,400. And here, with both hands known, a million simulations take longer than the exact count.

Does the margin tell the truth? I repeated the 1,000-hand simulation a thousand times, each with a different seed derived from 1. The estimates ran from 50.60 % to 60.10 %: at the extremes, two correct 1,000-hand simulations landed 9.5 points apart. In 952 of the 1,000, the interval contained the exact 55.57 %, close to the 95 in 100 that a 95 % margin promises. In the calculator, with 1,000 hands and seed 1, the “Check the margin” button repeats this same experiment.

Why they disagree

With that, the causes can be checked, each one measured with the same hand.

Too few simulated hands. With 1,000, the margin is ± 3.09 points. A calculator that does not show it gives you a number with more decimals than it knows.

Wins vs. equity. Some tools show the probability of winning and others show equity. With 8♠8♥ against A♦K♣ there are hardly any ties, and the difference is 0.15 points: 55.42 vs. 55.57. With A♠K♦ against A♥Q♣, which each hold an ace, ace-king wins 71.72 %, ties 4.59 % and its equity is 74.02 %: a 2.3-point difference without either of them being wrong.

Against which hand. Playing against ace-king is not the same as playing against any hand at all. Against a random hand, the pair of eights has 69.16 % equity: 13.59 points more.

How many players. If a third player comes in with J♥10♥, the pair goes from first to last: 31.66 %, against 35.84 % for ace-king and 32.51 % for jack-ten. The edge it had against one opponent does not hold against two.

A bug in the code. An evaluator that forgets the ace also plays low, in the A-2-3-4-5 straight, gives 55.94 % instead of 55.57 %. That is 0.37 points: with 1,000 or 10,000 hands it almost always stays inside the margin and goes unnoticed. With 100,000 (± 0.31) it separates in most runs, and with a million (± 0.10), in every run I tried. But only if you compare it against an exact figure from an evaluator that has already been checked: the exact count with the same faulty evaluator also gives 55.94 %.

To guard against that, the calculator’s evaluator was checked against the known counts of all 2,598,960 five-card hands and all 133,784,560 seven-card hands, and against a second evaluator written separately, in Python, on 200,000 random hands and on every exact equity with known hands in this note.

Three players and the random hand

With three known hands, the exact count costs about the same: it is 1,370,754 boards, fewer than with two, although each one has three hands to evaluate. It takes 0.35 s, against 0.3 s with two.

What makes it expensive is not knowing a hand. Against a random hand you have to go through, besides the boards, the 1,225 hands the opponent could hold: 2,097,572,400 deals. I ran it separately, on eight of the Mac’s cores, to get the exact 69.16 %, and it took 57 s. A million simulations with seed 1 give 69.18 % ± 0.09 in 0.76 s.

With three players and two random hands it would be 1,894,107,877,200 deals, about 900 times more: hours, not seconds. The exact count is still possible, but in practice simulation is all that is left.

How to tell which one is right

When two numbers disagree, before picking one:

To try it with your own hands, there is the exact equity against Monte Carlo calculator: it runs in the browser, gives the exact figure when it can and the simulated one with its margin, its number of hands and its seed, and checks whether the margin tells the truth.

None of these counts says which card will come. With 55.57 % equity, the pair of eights loses 44.28 % of the time against ace-king: having the favorable position is not the same as winning that hand. What the math gives you is how favorable the position is before the cards come. In the next poker note: whether, given that, poker is a game of skill or of luck, and how many hands it takes to know.

Israel Negrete Lepe is an electronics engineer. Twenty-five years making different systems work together under real conditions: from the sensor, the vehicle or the transaction to the backend, the data, security and operations. Today, increasingly, edge AI. I take on projects by the hour or by deliverable: israel0negrete@gmail.com.