Download Document

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Stat 35b: Introduction to Probability with Applications to Poker
Outline for the day:
1. Review list.
2. Farha vs. Antonius, expected value and variance.
3. Flush draws and straight draws.
4. Bayes’s rule example.
5. Rainbow flops, E(X), and SD(X).
6. Lucky poker.
7. Project B functions and example.
Midterm is Thur, Feb 23, in class. 75 min. Open book plus one page of
notes, double sided. Bring a calculator!   u 
u
1. Review List
1) Basic principles of counting.
2) Axioms of probability, and addition rule.
3) Permutations & combinations.
4) Conditional probability.
5) Independence.
6) Multiplication rules.
P(AB) = P(A) P(B|A) [= P(A)P(B) if ind.]
7) Odds ratios.
8) Random variables (RVs).
9) Discrete RVs, and probability mass function (pmf).
10) Expected value.
11) Pot odds calculations.
12) Luck, skill, and deal-making.
13) Variance and SD.
14) Bernoulli RV.
[0-1. µ = p, s = √(pq). ]
15) Binomial RV.[# of successes, out of n tries. µ = np, s = √(npq).]
16) Geometric RV.
[# of tries til 1st success. µ = 1/p, s = (√q) / p. ]
17) Negative binomial RV. [# of tries til rth success. µ = r/p, s = (√rq) / p. ]
18) E(X+Y), V(X+Y) (ch. 7.1).
19) Bayes’s rule (ch. 3.4).
Basically, we’ve done all of ch. 1-5 except 4.6, 4.7, and 5.5.
We’ve also done most of 6.1-6.5 but this won’t be on the midterm.
2) Farha vs. Antonius, expected value and variance.
Recall that E(X+Y) = E(X) + E(Y). Whether X & Y are independent or not!
Similarly, E(X + Y + Z + …) = E(X) + E(Y) + E(Z) + …
And, if X & Y are independent, then V(X+Y) = V(X) + V(Y).
so SD(X+Y) = √[SD(X)^2 + SD(Y)^2].
Also, if Y = 9X, then E(Y) = 9E(Y), and SD(Y) = 9SD(X). V(Y) = 81V(X).
Farha vs. Antonius.
Running it 4 times. Let X = chips you have after the hand. Let p be the prob. you win.
X = X1 + X2 + X3 + X4, where X1 = chips won from the first “run”, etc.
E(X) = E(X1) + E(X2) + E(X3) + E(X4)
= 1/4 pot (p) + 1/4 pot (p) + 1/4 pot (p) + 1/4 pot (p)
= pot (p)
= same as E(Y), where Y = chips you have after the hand if you ran it once!
But the SD is smaller: clearly X1 = Y/4, so SD(X1) = SD(Y)/4. So, V(X1) = V(Y)/16.
V(X) ~ V(X1) + V(X2) + V(X3) + V(X4),
= 4 V(X1)
= 4 V(Y) / 16
= V(Y) / 4.
So SD(X) = SD(Y) / 2.
3) Flush draws & Straight draws.
Probability needed to call all-in: P(win) must be ≥ Bet ÷ (Pot + Bet).
If your opponent bets the amount that was previously in the pot, then this probability is 1/3.
Suppose you have two s & there are exactly two s on the flop. [No info about opponents.]
Given this info, P(making a flush)?
= P(at least one more  on turn or river)
= 1 - P(non- on turn AND non- on river)
= 1 - choose(38,2) ÷ choose(47,2)
= 35.0%.
*** However, this assumes you’ll get to see both the turn and the river!
P(making an open-ended straight draw on turn or river)? [8 outs.]
= 1 - P(non-out on turn AND non-out on river)
= 1 - choose(39,2) ÷ choose(47,2)
= 31.5%.
*** However, if you hit your straight and bet, your opponent might call!
Implied odds: P(win) must be ≥ Bet ÷ (Pot + Bet + extra amount you’ll win later)
4. Bayes’ rule example.
Suppose P(your opponent has the nuts) = 1%, and P(opponent has a weak hand) = 10%.
Your opponent makes a huge bet. Suppose she’d only do that with the nuts or a weak
hand, and that P(huge bet | nuts) = 100%, and P(huge bet | weak hand) = 30%.
What is P(nuts | huge bet)?
P(nuts | huge bet) =
P(huge bet | nuts) * P(nuts)
------------------------------------------------------------------------------------------P(huge bet | nuts) P(nuts) + P(huge bet | horrible hand) P(horrible hand)
=
100% * 1%
--------------------------------------100% * 1% + 30% * 10%
= 25%.
5. Rainbow flops.
P(Rainbow flop) = choose(4,3)
*
choices for the 3 suits
13 * 13 * 13
÷ choose(52,3)
numbers on the 3 cards
possible flops
~ 39.76%.
Q: Out of 100 hands, what is the expected number of rainbow flops? +/- what?
X = Binomial (n,p), with n = 100, p = 39.76%, q = 60.24%.
E(X) = np = 100 * 0.3976 = 39.76
SD(X) = √(npq) = sqrt(23.95) = 4.89.
So, expect around 39.76 +/- 4.89 rainbow flops, out of 100 hands.
5. Rainbow flops, continued.
P(Rainbow flop) ~ 39.76%.
Q: Let X = the number of hands til your 4th rainbow flop.
What is P(X = 10)? What is E(X)? What is SD(X)?
X = negative binomial (r,p), with r = 4, p = 39.76%, q = 60.24%.
P(X = k) = choose(k-1, r-1) pr qk-r.
Here k = 10. P(X = 10) = choose(9,3) 39.76%4 60.24%6 = 10.03%.
µ = E(X) = r/p = 4 ÷ 0.3976 = 10.06 hands.
s = SD(X) = (√rq) / p = sqrt(4*0.6024) / 0.3976 = 3.90 hands.
So, you expect it typically to take around
10.06 +/- 3.90 hands til your 4th rainbow flop.
6. “Lucky Poker”
A, B, C. A & B are a team.
No strategy: only muck (fold) at the end or don’t muck.
First player to two points wins the game.
P(C wins)?
If A has a point and B doesn’t, A should show first. B can muck.
•
P(C wins in 2 hands) = 1/9 = 3/27
•
P(C wins in 3 hands) = 4/27.
•
P(C wins in 4 hands) = 1/27. Why?
(ACC, BCC, CAC, CBC)
6 ways for this to happen. {CABC, CBAC, ACBC, BCAC, ABCC, or BACC}.
If A has a pt and B doesn’t, then P(B winning a pt on next hand) = 1/6:
{A>B>C, A>C>B, B>A>C, B>C>A, C>A>B, C>B>A}.
So, P(C wins in 4 hands) = 6 x {1/3 x 1/3 x 1/6 x 1/3} = 1/27.
So, P(C wins) = 3/27 + 4/27 + 1/27 = 8/27.
7) Proj. B functions and example.
FUNCTIONS FOR PROJECT B:
straightdraw1 = function(x)
## returns 4 is there are 2 possibilities for a straight.
## returns 2 for a gutshot straight draw.
## returns 0 otherwise
## Note: returns 26 if you already have a straight!
flushdraw1 = function(x)
## returns the max number of one suit
## (4 if flush draw, 5 if a flush already!)
handeval = function(num1,suit1){
Straight-flush: return 8 million - 8,999,999
4 of a kind: return 7 million - 7,999,999
Full house: 6 million - 6,999,999, etc.
. nada
0
1pr
1mil
2pr
2mil
3-kind straight flush full-house 4-kind str-flush .
3mil
4mil
5mil
6mil
7mil
8mil
9mil
7) Proj. B example.
zelda = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1,
roundbets, blinds1, chips1, ind1, dealer1, tablesleft){
a1 = 0 ## how much I'm gonna end up betting. Note that the default is zero.
a2 = min(mychips1, currentbet) ## how much it costs to call
if(round1 == 1){ ## pre-flop:
## AK: Make a big raise if nobody has yet. Otherwise call.
## AQ: call a small raise, or make one if nobody has yet.
## AJ, AT, KQ, KJ, QJ: call a tiny raise.
## A9, KT, K9, QT, JT, T9: call a tiny raise if in late position (within 2 of the dealer).
## Suited A2-AJ: call a small raise.
## 22-99: call a small raise.
## TT-KK: make a huge raise. If someone's raised huge already, then go all in.
## AA: make a small raise. If there's been a raise already, then double how much it is to you.
a3 = 2*blinds1+1 ## how much a tiny raise would be
a4 = 4*blinds1+1 ## how much a small raise would be
a5 = max(8*blinds1,mychips1/4)+1 ## how much a big raise would be
a6 = max(12*blinds1,mychips1/2)+1 ## how much a huge raise would be
a7 = dealer1 - ind1
if(a7 < -.5) a7 = a7 + numattable1 ## your position: a7 = how many hands til you're dealer
if((crds1[1,1] == 14) && (crds1[2,1] == 13)){ a1 = max(a2,a5) }
if((crds1[1,1] == 14) && (crds1[2,1] == 12)){
if(a2 < a4){
a1 = a4
} else if(a2 > a5){
a1 = 0
} else a1 = a2
}
if(((crds1[1,1] == 14) && ((crds1[2,1] < 11.5) && (crds1[2,1] > 9.5))) ||
((crds1[1,1] == 13) && (crds1[2,1] > 10.5)) ||
((crds1[1,1] == 12) && (crds1[2,1] == 11))){
if(a2 < a3) a1 = a2
}
if(((crds1[1,1] == 14) && (crds1[2,1] == 9)) ||
((crds1[1,1] == 13) && ((crds1[2,1] == 10) || (crds1[2,1] == 9))) ||
((crds1[1,1] == 12) && (crds1[2,1] == 10)) ||
((crds1[1,1] == 11) && (crds1[2,1] == 10)) ||
((crds1[1,1] == 10) && (crds1[2,2] == 9))){
if((a2 < a3) && (a7<2.5)) a1 = a2
}
if((crds1[1,2] == crds1[2,2]) && (crds1[1,1] == 14) && (crds1[2,1] < 11.5)){
if(a2<a4) a1 = a2
## Note: this trumps the previous section, since it comes later in the code.
}
if((crds1[1,1] == crds1[2,1])){ ## pairs:
if(crds1[1,1] < 9.5){
if(a2 < a4) a1 = a2
} else if(crds1[1,1] < 13.5){
if(a2<a5) a1 = a5 else a1 = mychips1
} else {
if(a2 < blinds1 + .5) a1 = a4 else a1 = min(2*a2,mychips1)
}}}
if(round1 == 2){ ## post-flop:
## If there's a pair on the board and you don't have a set, then check/call up to small bet.
## Same thing if there's 3-of-a-kind on the board and you don't have a full house or more.
## If you have top pair or an overpair or two pairs or a set, make a big bet (call any bigger bet).
## Otherwise, if nobody's made even a small bet yet, then with prob. 20% make a big bluff bet.
## If you're the last to decide and nobody's bet yet, then increase this prob. to 50%.
## If you have an inside straight draw or flush draw then make a small bet (call any bigger bet).
## If you have a straight or better, then just call.
## Otherwise fold.
a5 = min(sum(roundbets[,1]),mychips1) ## how much big bet would be (prev round's pot size)
a6 = min(.5*sum(roundbets[,1]),mychips1) ## how much a small bet would be
x = handeval(c(crds1[1:2,1], board1[1:3,1]), c(crds1[1:2,2], board1[1:3,2])) ## what you have
x1 = handeval(c(board1[1:3,1]),c(board1[1:3,2])) ## what's on the board
y = straightdraw1(c(crds1[1:2,1], board1[1:3,1]))
z = flushdraw1(c(crds1[1:2,2], board1[1:3,2]))
topcard1 = max(board1[1:3,1])
a7 = runif(1) ## random number uniformly distributed between 0 and 1
a8 = (1:numattable1)[roundbets[,1] == roundbets[ind1,1]] ## others who can still bet with you
## The next 5 lines may seem weird, but the purpose is explained in the next comment:
a9 = a8 - dealer1
for(i in 1:length(a9)) if(a9[i]<.5) a9[i] = a9[i] + numattable1
a10 = ind1 - dealer1
if(a10 < .5) a10 = a10 + numattable1
a11 = 2*(a10 == max(a9)) ## So a11 = 2 if you're last to decide; otherwise a11 = 0.
if((x1 > 1000000) && (x < 3000000)){
if(a2 < a6) a1 = a2
} else if((x1 > 3000000) && (x < 6000000)){
if(a2 < a6) a1 = a2
} else if(x > 1000000 + 15^3*topcard1){
a1 = max(a5,a2)
} else if((a2 < a6) && ((a7 < .20) || ((a7 < .50) && (a11>1)))){
a1 = a6
}
if((y == 4) || (z == 4)) a1 = max(a6, a2)
if(x > 4000000) a1 = a2
}
if(round1 == 3){ ## after turn:
## If there's a pair on the board and you don't have a set, then check/call up to small bet.
## Same thing if there's 3-of-a-kind on the board and you don't have a full house or more.
## Otherwise, if you have top pair or better, go all in.
## If you had top pair or overpair but now don't, then check/call a medium bet but fold to more.
## If you have an inside straight draw or flush draw then check/call a medium bet as well.
## Otherwise check/fold.
a6 = min(1/3*sum(roundbets[,1:2]),mychips1) ## small bet (1/3 of prev round's pot size)
a5 = min(.75*sum(roundbets[,1:2]),mychips1) ## medium bet (3/4 of prev round's pot)
x = handeval(c(crds1[1:2,1], board1[1:4,1]), c(crds1[1:2,2], board1[1:4,2])) ## what you have
x1 = handeval(c(board1[1:4,1]),c(board1[1:4,2])) ## what's on the board
y = straightdraw1(c(crds1[1:2,1], board1[1:4,1]))
z = flushdraw1(c(crds1[1:2,2], board1[1:4,2]))
topcard1 = max(board1[1:4,1])
oldtopcard1 = max(board1[1:3,1])
if((x1 > 1000000) && (x < 3000000)){
if(a2 < a6) a1 = a2
} else if((x1 > 3000000) && (x < 6000000)){
if(a2 < a6) a1 = a2
} else if(x > 1000000 + 15^3*topcard1){
a1 = mychips1} else if(x > 1000000 + 15^3*oldtopcard1){
if(a2 < a5) a1 = a2
} else if((y == 4) || (z == 4)){ if(a2 < a5) a1 = a2 } }
if(round1 == 4){ ## after river:
## If there's a pair on the board and you don't have a set, then check/call up to small bet.
## Same thing if there's 3-of-a-kind on the board and you don't have a full house or more.
## Otherwise, if you have two pairs or better, go all in.
## If you have one pair, then check/call a small bet.
## With nothing, go all-in with probability 10%; otherwise check/fold.
a6 = .45+runif(1)/10 ## random number between .45 and .55
a5 = min(a6*sum(roundbets[,1:3]),mychips1) ## small bet~ 1/2 of pot size; varies randomly
x = handeval(c(crds1[1:2,1], board1[1:5,1]), c(crds1[1:2,2], board1[1:5,2]))
x1 = handeval(c(board1[1:5,1]),c(board1[1:5,2])) ## what's on the board
if((x1 > 1000000) && (x < 3000000)){
if(a2 < a5) a1 = a2
} else if((x1 > 3000000) && (x < 6000000)){
if(a2 < a5) a1 = a2
} else if(x > 2000000){
a1 = mychips1
} else if(x > 1000000){
if(a2 < a5) a1 = a2
} else if(runif(1)<.10){
a1 = mychips1}
}
round(a1)
} ## end of zelda
Related documents