-
Notifications
You must be signed in to change notification settings - Fork 8
/
poker
executable file
·32 lines (27 loc) · 1018 Bytes
/
poker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
from __future__ import division
from numpy import *
import pylab
def limit_donkey_equity(k):
"""In the case of infinite stack size, Alice's optimal strategy is simply to wait for AA. The resulting
win probability function satisfies
p[t] = 0, t <= 0
p[t] = 1, t >= 1
p[t] = a p[2t] + (1-a) p[2t-1], 0 < t < 1
where a is the probability of winning with AA (splitting ties). Important properties:
1. p is continuous.
2. If t is a dyadic rational, p[t] is a function of simpler dyadic rationals.
This provides an easy, superfast way of computing p.
Bug: actually, splitting ties doesn't produce the right answer. To be correct, "a" below should
become b/(1-c), where a is the win probability and c is the tie probability. Still a fractal, though.
"""
a = 893604787/1048786200
p = zeros(1)
for k in xrange(k):
p = hstack([a*p,a+(1-a)*p])
return hstack([p,1])
k = 20
t = arange(2**k+1)/2**k
p = limit_donkey_equity(k)
pylab.plot(t,p)
pylab.show()