#1
|
|||
|
|||
Approximating the probablity of a higher pair
To approximate the probability of an opponent being dealt a higher pocket pair than yours, use:
P(p, q) = p*q*(50 - 2? - min(p,q))/100 where p : number or opponents q : number of higher pairs x? : if p >= 5 and q >= 11, return x, else return 0 min(x, y) : the smaller of x and y This accurate to within an absolute error of about 0.7%. If the "- 2?" term is omitted, the maximum absolute error grows to only about 2.3%, so most practical purposes, it can be ignored altogether. Here is a table generated by the above formula: <font class="small">Code:</font><hr /><pre> 1 2 3 4 5 6 7 8 9 KK 0.5 1.0 1.5 2.0 2.5 2.9 3.4 3.9 4.4 QQ 1.0 1.9 2.9 3.8 4.8 5.8 6.7 7.7 8.6 JJ 1.5 2.9 4.2 5.6 7.0 8.5 9.9 11.3 12.7 TT 2.0 3.8 5.6 7.4 9.2 11.0 12.9 14.7 16.6 99 2.5 4.8 7.0 9.2 11.3 13.5 15.8 18.0 20.3 88 2.9 5.8 8.5 11.0 13.5 15.8 18.5 21.1 23.8 77 3.4 6.7 9.9 12.9 15.8 18.5 21.1 24.1 27.1 66 3.9 7.7 11.3 14.7 18.0 21.1 24.1 26.9 30.2 55 4.4 8.6 12.7 16.6 20.3 23.8 27.1 30.2 33.2 44 4.9 9.6 14.1 18.4 22.5 26.4 30.1 33.6 36.9 33 5.4 10.6 15.5 20.2 23.6 27.7 31.6 35.2 38.6 22 5.9 11.5 16.9 22.1 25.8 30.2 34.4 38.4 42.1 </pre><hr /> Here is the table of the absolute error differences: <font class="small">Code:</font><hr /><pre> 1 2 3 4 5 6 7 8 9 KK 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 QQ 0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0 0.0 0.1 JJ 0.0 -0.0 -0.1 -0.1 -0.1 -0.1 -0.1 -0.0 0.1 TT 0.0 -0.0 -0.1 -0.3 -0.3 -0.2 -0.1 -0.0 0.1 99 0.0 -0.1 -0.1 -0.3 -0.5 -0.4 -0.3 -0.1 0.1 88 0.0 -0.0 -0.1 -0.2 -0.4 -0.6 -0.4 -0.2 0.1 77 0.0 -0.0 -0.1 -0.2 -0.3 -0.5 -0.7 -0.4 0.0 66 0.0 0.0 -0.0 -0.1 -0.2 -0.2 -0.4 -0.6 -0.1 55 0.0 0.0 0.0 0.0 0.1 0.0 0.0 -0.1 -0.2 44 0.0 0.0 0.1 0.2 0.3 0.4 0.4 0.5 0.5 33 -0.0 0.1 0.2 0.4 -0.5 -0.6 -0.5 -0.6 -0.6 22 0.0 0.1 0.3 0.6 -0.3 -0.2 -0.1 0.1 0.2 </pre><hr /> Here is the output of my Monte Carlo program, which I used to estimate the absolute error: <font class="small">Code:</font><hr /><pre> Number of iterations = 12345678 1 2 3 4 5 6 7 8 9 KK 0.0049 0.0098 0.0147 0.0196 0.0244 0.0293 0.0342 0.0390 0.0439 QQ 0.0098 0.0195 0.0292 0.0388 0.0484 0.0577 0.0672 0.0767 0.0859 JJ 0.0147 0.0292 0.0437 0.0578 0.0717 0.0857 0.0993 0.1129 0.1262 TT 0.0195 0.0389 0.0578 0.0764 0.0947 0.1128 0.1303 0.1476 0.1649 99 0.0245 0.0485 0.0719 0.0948 0.1170 0.1391 0.1603 0.1815 0.2016 88 0.0294 0.0580 0.0857 0.1128 0.1390 0.1646 0.1893 0.2134 0.2369 77 0.0343 0.0675 0.0995 0.1305 0.1606 0.1895 0.2175 0.2446 0.2709 66 0.0392 0.0768 0.1131 0.1479 0.1817 0.2136 0.2447 0.2748 0.3033 55 0.0440 0.0863 0.1267 0.1653 0.2019 0.2374 0.2708 0.3033 0.3342 44 0.0490 0.0955 0.1399 0.1821 0.2221 0.2601 0.2966 0.3312 0.3638 33 0.0539 0.1049 0.1530 0.1985 0.2418 0.2828 0.3212 0.3577 0.3923 22 0.0587 0.1140 0.1661 0.2149 0.2612 0.3040 0.3450 0.3833 0.4194 </pre><hr /> Note that each data point is the result of 12,345,678 iterations. Here is my Monte Carlo program written in Python: <font class="small">Code:</font><hr /><pre> # Straightforward Monte Carlo program to determine probability of # a higher pair being dealt to one of your opponents. from random import * deck = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14] card = "??23456789TJQKA" ni = input("%26s" % ("Number of iterations = ")) plrs = input("%26s" % ("Range of opponents = ")) np = len(plrs) ranks = input("%26s" % ("Range of ranks = ")) seed() print "" for p in plrs: print "%6u" % (p), for r in ranks: deck.remove(r) deck.remove(r) print "\n%s" % (card[r]*2), for p in plrs: c = 0 for i in range(ni): shuffle(deck) for j in range(p): if deck[j] == deck[j + p] and deck[j] > r: c += 1 break print "%6.4f" % (float(c)/ni), deck.append(r) deck.append(r) </pre><hr /> |
#2
|
|||
|
|||
Re: Approximating the probablity of a higher pair
I love it
|
|
|