Hand strength assesses how strong your hand is in relation to what other players may hold. Critical to the program's performance, it is computed on the flop, turn and river by a weighted enumeration which provides an accurate estimate of the probability of currently holding the strongest hand. This calculation is feasible in real-time: on the flop there are 47 remaining unknown cards so possible hands an opponent might hold. Similarly there are on the turn and on the river.
Figure 5.1 contains the algorithm for computing hand strength. The bulk of the work is in the call to the hand identification function Rank which, when given a hand containing at least 5 cards, determines the strongest 5-card hand and maps it to a unique value such that stronger poker hands are given larger values and hands of equal strength are given the same value. Rank must be called times where n is the number of unknown cards.
The parameter w is an array of weights, indexed by two card combinations, so the function determines a weighted sum. It is the weight array for the opponent under consideration (each possible two-card holding is assigned a weight). When the array is normalized so the sum is 1, the weights are conditional probabilities meaning ``for each possible two-card holding what is the probability that it is the hand held by this opponent" (given the observed betting). Without normalization, the values in the weight table are conditional probabilities meaning ``what is the probability that this opponent would have played in the observed manner" (given they held this hand). Without opponent modeling, it can simply be filled with a default set of values, either a uniform or `typical' distribution. Under uniform weighting each entry in the array is equal (an appropriate representation if the opponent has a random hand). A more typical distribution would be a set of values based on the IR tables. This is the only model information used directly by the hand strength enumeration.
Suppose our starting hand is A-Q and the flop is 3-4-J (1,081 possible opponent hands). To estimate hand strength using uniform weighting, the enumeration technique gives a percentile ranking of our hand (our hand rank). We simply count the number of possible hands that are better than ours (any pair, two pair, A-K, or three of a kind: 444 hands), how many hands are equal to ours (9 possible remaining A-Q combinations), and how many hands are worse than ours (628). Counting ties as half, this corresponds to a hand rank (HR) of 0.585. In other words there is a 58.5% chance that our hand is better than a random hand (against non-uniform weights we call it hand strength, or HS).
This measure is with respect to one opponent, but when all
opponents have the same weight array it can be roughly extrapolated
to multiple opponents by raising it to the power of the
number of active opponents (HR_{n} is
the hand rank against n opponents,
).
HR_{n} = (HR_{1})^{n}. | (5.2) |
It is not an exact value because it does not take into account interdependencies arising from the fact that two players cannot hold the same card. However, this is a secondary consideration.
Continuing the example, against five opponents with random hands the adjusted hand rank is HS_{5} = .585^{5} = .069. Hence, the presence of additional opponents has reduced the likelihood of our having the best hand to only 6.9%.
This example uses a uniform weighting: it assumes that all opponent hands are equally likely. In reality this is not the case. Many weak hands like 4-J (IR < 0) would have been folded before the flop. However, with the example flop of 3-4-J, these hidden cards make a strong hand that skews the hand evaluations. Specifically, accuracy of the estimates depend strongly on models of our opponents (the array of weights w). Therefore, we compute weighted sums to obtain hand strength (HS). As with HR, HS_{n} is the hand strength against n opponents and .