## Flop Analysis Part 4 – Calculated values and code check

Before we get to the real data, we first need to check our code and our calculations. The input for the run shown below is the set of all possible flops enumerated, rather than real hand data. There are 132,600 possible flops (permutations, not combinations, of which there are 132,600/3! or 22,100), and so we have one of every possible flop in the run. We create these with a simple set of 3 nested FOR loops that runs through each of the 52 cards in each position, giving us 52*51*50 flops, or 132600.

If the calculated values match our enumerated counts, then we know that the calculation is correct, and that the filter to count that particular flop type is also correct (or at least that we are counting the same flop type we are calculating).

I’m showing the offsets measured two ways, both in +/- count per hundred-thousand flops (+-/100K), and in standard deviations between the means (+/- SDs). The +/-100K is useful when looking at millions of flops, since the number of SDs is not very intuitive by itself unless you have spent some time looking at them for different sample sizes. Even though the /100K isn’t balanced for different probability flops, it helps us immediately see the absolute scale of the offsets. It measures the **effect size**. The SD on the other hand, measures the **significance** of the effect, or how likely the result could have occurred by chance (assuming that we are comparing to the mean of a random variable).

The SD offset is calculated here using this formula:

where obs = observed frequency, p = expected frequency, q = 1-p, and n = number of boards.

Note that the above is equivalent to this calculation, where we just take the difference in count over the SD:

Obviously all types should show zero offset in this **enumerated run**, or I’d have a code error or an incorrect calculation.

Number of flops enumerated: 132,600 FLOP TYPES FREQUENCY --------------------------------------------------------------------------------------------[ FLOP TYPE ] Calculated Actual +-/100K +/-SDs Calc /132600[ Rainbow ] 39.76471% 39.76471% 0 0.00 52*39*26 [ Monotone ] 5.17647% 5.17647% 0 0.00 52*12*11 [ Two-suited ] 55.05882% 55.05882% 0 0.00 (52*12*39)*3 [---check suit types---] 100.00000% 100.00000% [ Paired flop ] 16.94118% 16.94118% 0 0.00 (52*3*48)*3 [ Triplet flop ] 0.23529% 0.23529% 0 0.00 52*3*2 [ Unpaired flop ] 82.82353% 82.82353% 0 0.00 52*48*44 [--check match types---] 100.00000% 100.00000% [ Pair & connector ] 2.82353% 2.82353% 0 0.00 (52*3*8)*3 [ Pair & 1gap ] 2.60633% 2.60633% 0 0.00 ((44*3*8)+(8*3*4))*3 [ Pair & 2gap ] 2.38914% 2.38914% 0 0.00 ((36*3*8)+(16*3*4))*3 [ Pair & 3+gap ] 9.12217% 9.12217% 0 0.00 ((36*3*24)+(8*3*(28+32)))*3 [ Triplets ] 0.23529% 0.23529% 0 0.00 52*3*2 [ 3-Straight ] 3.47511% 3.47511% 0 0.00 12*(4^3)*6 [ Connector & 1gap ] 6.95023% 6.95023% 0 0.00 24*(4^3)*6 [ Connector & 2gap ] 6.37104% 6.37104% 0 0.00 ((36*4*8)+(16*4*4))*6 [ Connector & 3+gap ] 20.56109% 20.56109% 0 0.00 ((36*4*20)+(8*4*(28+24)))*6 [ KA2 double connector ] 0.28959% 0.28959% 0 0.00 12*8*4 [ Double gutshot ] 3.18552% 3.18552% 0 0.00 11*(4^3)*6 [ Other 1gaps ] 21.42986% 21.42986% 0 0.00 4736*6 [ No cnct no 1gap no pr] 20.56109% 20.56109% 0 0.00 all other hands: 27264 [-check connect types--] 100.00000% 100.00000%[ Flop Combinations ] Calculated Actual +-/100K +/-SDs Calc /132600

[ Pair & cnctr rainbow] 1.41176% 1.41176% 0 0.00 (52*3*4)*3 [ Pair & cnctr 2-suited] 1.41176% 1.41176% 0 0.00 (52*3*4)*3 [ Pair & 1gap rainbow] 1.30317% 1.30317% 0 0.00 ((44*3*4)+(8*3*2))*3 [ Pair & 1gap 2-suited] 1.30317% 1.30317% 0 0.00 ((44*3*4)+(8*3*2))*3 [ Pair & 2gap rainbow] 1.19457% 1.19457% 0 0.00 ((36*3*4)+(16*3*2))*3 [ Pair & 2gap 2-suited] 1.19457% 1.19457% 0 0.00 ((36*3*4)+(16*3*2))*3 [ Pair & 3+gap rainbow] 4.56109% 4.56109% 0 0.00 ((36*3*12)+(8*3*(14+16)))*3 [ Pair & 3+gap 2-suited] 4.56109% 4.56109% 0 0.00 ((36*3*12)+(8*3*(14+16)))*3 [ Triplets ] 0.23529% 0.23529% 0 0.00 52*3*2 [ 3-Straight rainbow] 1.30317% 1.30317% 0 0.00 (48*3*2)*6 [ 3-Straight 2-suited] 1.95475% 1.95475% 0 0.00 (48*3*3)*6 [ 3-Straight-Flush ] 0.21719% 0.21719% 0 0.00 (12*4)*6 [ Cnctr & 1gap rainbow] 2.60633% 2.60633% 0 0.00 (24*(4*3*2)*6) [ Cnctr & 1gap monotone] 0.43439% 0.43439% 0 0.00 (24*(4*1*1)*6) [ Cnctr & 1gap 2-suited] 3.90950% 3.90950% 0 0.00 (24*(4*3*3)*6) [ Cnctr & 2gap rainbow] 2.38914% 2.38914% 0 0.00 ((36*3*4)+(16*3*2))*6 [ Cnctr & 2gap monotone] 0.39819% 0.39819% 0 0.00 ((36*1*2)+(16*1*1))*6 [ Cnctr & 2gap 2-suited] 3.58371% 3.58371% 0 0.00 ((36*3*(4+2))+(16*3*(2+1)))*6 [ Cnctr & 3+gp rainbow] 7.71041% 7.71041% 0 0.00 ((36*3*10)+(8*3*(14+12)))*6 [ Cnctr & 3+gp monotone] 1.28507% 1.28507% 0 0.00 ((36*1*5)+(8*1*(7+6)))*6 [ Cnctr & 3+gp 2-suited] 11.56561% 11.56561% 0 0.00 ((36*3*15)+(8*3*39))*6(see below)[ KA2 dbl-cnct rainbow] 0.10860% 0.10860% 0 0.00 12*6*2 [ KA2 dbl-cnct monotone] 0.01810% 0.01810% 0 0.00 12*2*1 [ KA2 dbl-cnct 2-suited] 0.16290% 0.16290% 0 0.00 (12*3*2)*3 [ Dbl gutshot rainbow] 1.19457% 1.19457% 0 0.00 (11*4*3*2)*6 [ Dbl gutshot monotone] 0.19910% 0.19910% 0 0.00 (11*4*1*1)*6 [ Dbl gutshot 2-suited] 1.79186% 1.79186% 0 0.00 ((11*1*3*4)*3)*6 [ Other 1-gaps rainbow] 8.03620% 8.03620% 0 0.00 enumerated 1776*6 [ Other 1-gaps monotone] 1.33937% 1.33937% 0 0.00 enumerated 296*6 [ Other 1-gaps 2-suited] 12.05430% 12.05430% 0 0.00 enumerated 2664*6 [ No cnt/gp/pr rainbow] 7.71041% 7.71041% 0 0.00 enumerated 1704*6 [ No cnt/gp/pr monotone] 1.28507% 1.28507% 0 0.00 enumerated 284*6 [ No cnt/gp/pr 2-suited] 11.56561% 11.56561% 0 0.00 enumerated 2556*6 [--check combinations--] 100.00000% 100.00000%[More Interesting flops] Calculated Actual +-/100K +/-SDs Calc /132600[ Any A or K or both ] 40.07240% 40.07240% 0 0.00 (52*51*50)-(44*43*42) [ Triple-BWay unpaired ] 2.89593% 2.89593% 0 0.00 20*16*12 [ Triple-BWay paired ] 2.17195% 2.17195% 0 0.00 (20*3*16)*3 [ Double-BWay unpaired ] 23.16742% 23.16742% 0 0.00 (20*16*32)*3 [ Double-BWay paired ] 4.34389% 4.34389% 0 0.00 (20*3*32)*3 [ 3 to a Wheel no pr ] 2.89593% 2.89593% 0 0.00 20*16*12 [ 2 to a Wheel no pr ] 23.16742% 23.16742% 0 0.00 (20*16*32)*3** detail ((36*3*(10+5))+(8*3*(14+12+7+6)))*6

Notice that I’ve chosen to divide them into 40 specific types (the last two sections) that are relevant to poker hands. Also, the calculations in the right hand column will make sense to anyone who works through the problem of counting the combinations, but the more complex ones may not be intuitive at first glance.

**We’ll also be checking the rank distribution for each flop type**. The enumerated values are below, and the explanations for the red values are below the chart. For space here I’ve combined the middle ranks that have identical probabilities, but we count all ranks individually in all of the actual data.

Expected Rank Frequencies [ Flop Type ] Two Three Four Five 6,7,8,9,T Jack Queen King Ace[ Rainbow ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Monotone ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Two-suited ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Paired flop ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Triplet flop ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Unpaired flop ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Pair & connector ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ Pair & 1gap ] 4.17% 8.33% 8.33% 8.33 8.33% 8.33% 8.33% 4.17% 8.33% [ Pair & 2gap ] 4.55% 4.55% 9.09% 9.09 9.09% 9.09% 4.55% 4.55% 9.09% [ Pair & 3+gap ] 9.52% 8.33% 7.14% 7.14 7.14% 7.14% 8.33% 9.52% 7.14% [ Triplets ] 7.69% 7.69% 7.69% 7.69 7.69% 7.69% 7.69% 7.69% 7.69% [ 3-Straight ] 5.56% 8.33% 8.33% 8.33 8.33% 8.33% 8.33% 5.56% 5.56% [ Connector & 1gap ] 5.56% 6.94% 8.33% 8.33 8.33% 8.33% 6.94% 5.56% 8.33% [ Connector & 2gap ] 6.06% 4.55% 7.58% 9.09 9.09% 7.58% 4.55% 6.06% 9.09% [ Connector & 3+gap ] 8.92% 8.92% 7.51% 7.04 7.04% 7.51% 8.92% 8.92% 7.04% [ KA2 double connector ] 33.33% - - - - - - 33.33%33.33% [ Double gutshot ] 3.03% 9.09% 6.06% 9.09 9.09% 6.06% 9.09% 3.03% 9.09% [ Other 1gaps ] 6.31% 8.11% 8.56% 7.66 7.66% 8.56% 8.11% 6.31% 8.11% [ No cnct no 1gap no pr] 9.86% 7.04% 7.04% 7.51 7.51% 7.04% 7.04% 9.86% 7.04%

Again, these are enumerated values, or what would be expected from a perfectly distributed flop. The rank distributions are the same for rainbow, monotone, or two-suited so the combinations section isn’t shown.

**Notice the types that are not symetrical between high and low card frequencies. Those will be affected by the known rank bias that we discussed in part 2.** These include 3-straights, which use an A or K 33% less often than they do a 3 or 4. And “Connector & 2-gap” flops, which include an Ace 50% more often than they include a Two, and include a King 33% more often than a Three. And “Pair & 2-gap” flops which include an Ace twice as often as a Two. These imbalances are simply the result of which ranks can naturally form these relevant card patterns. But because of the known rank bias for seen flops, these patterns will not show up at the expected rates.

The calculations for the the red values are below, and these confirm that our code is counting ranks properly.

**Pair & 1-gap** : Expected to have half as many 2s and Ks as all other ranks, since 22 and KK can only have a gap on one end (inside). Expect 4.167% for Two and K, 8.333% all others, so (2 * 4.167%) + (11 * 8.333%) = 100%.

**Pair & 2-gap** : Expected to have half as many 2s, 3s, Qs, and Ks as all other ranks, since they can only have a 2-gap on one side. Expect 4.545% for 2s, 3s, Qs, and Ks, 9.091% for all others, so (4 * 4.545%) + (9 * 9.091%) = 100%

**Pair & 3-gap+** : Expected to have one-third more 2s and Ks since they can be paired in this pattern with 8 other ranks instead of 6. Expected to have one-sixth more 3s and Qs since they can be paired in this pattern with 7 other ranks instead of 6 . Expect 8.333% for 3s and Qs, and 9.524% for 2s and Ks, 7.143% for all others, so (2 * 8.333%) + (2 * 9.524%) + (9 * 7.143%) = 100%

**3-straight **: Expected to have one-third fewer 2s, Ks and Aces than other ranks, since those can only be in two different 3-straights, and other ranks can be in three different 3-straights. Expect 5.556% for 2, K and Ace, 8.333% all others, so (3 * 5.556%) + (10 * 8.333%) = 100%.

**Cnctr & 1-gap** : Expected to have one-third fewer 2s and Ks than other ranks, since 2 and K can only be in this pattern four ways, and all other ranks (except 3 or Q) can be in this pattern six ways. 3s and Qs are expected to have 5/6 as many as other ranks since they can only be in this pattern five ways. Expect 5.556% for 2 and K, 6.944% for 3 and Q, 8.333% others, so (2 * 5.556%) + (2 * 6.944) + (9 * 8.333%) = 100%.

**Cnctr & 2-gap** : 5s thru Ts, and Aces, can be in this pattern 6 ways. 4s and Js should have only 5/6 as many since they can only be in this pattern 5 ways. 2s and Ks should only have 4/6 as many since they can only be in this pattern 4 ways. 3s and Qs should only have 3/6 as many since they can only be in this pattern 3 ways. Expect 6.061% for 2s and Ks, 4.545% for 3s and Qs, 7.576% for 4s and Js, and 9.091% for all others, so (6.061% * 2) + (4.545% * 2) + (7.576% * 2) + (9.091% * 7+ = 100%.

**Cnctr & 3gap+** : There are 71 unique rank combinations that can form this pattern, with 3 cards each so 213 card occurrences (disregarding suits). 5s thru Ts, and Aces, each appear in 15 of them. 2s, 3s, Qs, and Ks each appear in 19 of them, so 4/15ths more often. 4s and Js each appear in 16 of them, so 1/15 more often. (7*15)+(4*19)+(2*16)=213. We expect 5s thru Ts and aces to appear 7.042%, {2s 3s Qs Ks} to appear 8.920%, and 4s and Js to appear 7.512%. So (7 * 7.042%) + (4 * 8.920%) + (2 * 7.512%) = 100%.

**KA2 dbl cnctr** : Obviously 33.3% each with all other ranks zero. **This pattern is going to be heavily skewed by high card removal** since it requires twice as many high cards as low, so we expect to flop less of this pattern than the calculated amount. However, the ratio of the ranks will always be 1/3 each.

**Double gutshot** : Expected to have one-third as many 2s and Ks as other ranks since they can only be in this pattern 1 of 3 ways. Expect to have 2/3 as many 4s and Js as other ranks since they can only be in this pattern 2 of 3 ways. Expect 3.030% for 2 and K, 6.061% for 4 and J, 9.091% others, so (2 * 3.030%) + (2 * 6.061) + (9 * 9.091%) = 100%.

**Other 1-gaps** : These are flops with a 1-gap present but no pair, no connector, and no double gut. Expect 6.306% for 2s and Ks, 8.108% for 3s, Qs, and Aces, 8.559% for 4s and Js, and 7.658% for others. These are enumerated counts since the patterns are complex to describe. (2 * 6.306%) + (3 * 8.108) + (2 * 8.559) + (6 * 7.658%) = 100%.

**No cnct/1gp/pr** : These are flops with no 1-gaps, no pair, and no connectors. Expect 9.859% for 2s and Ks, 7.042% for 3,4,J,Q and A, and 7.512% for others. These are enumerated counts since the patterns are complex to describe. (2 * 9.859%) + (5 * 7.042) + (6 * 7.512%) = 100%.

In the combination types the rank distribution is not affected by their suitedness, and so they should come out the same whether rainbow, monotone, or two-suited.

** **

**In an upcoming post we’ll look at a few hundred million real flops.**

—————