pacomartin
pacomartin
  • Threads: 649
  • Posts: 7895
Joined: Jan 14, 2010
February 8th, 2010 at 1:57:40 PM permalink
This post is meant to be pedagogical. Expected values(EV) are what you will see in Appendix 9 . If you look for dealer 10 against a player 10,9 for a single deck game the EV is 0.102517 if the player chooses to stand. This post is for people interested in how that calculation is done.

Most people would try to calculate EV's in blackjack by simulations since it is so complex. But the Wizard has done all his expected value calculations explicitly.

The calculations are lengthy even for the simplest cases, but I thought I would post the results if anyone wants to try to write their own computer program. If the player chooses to stand it is a simpler problem since only the dealer is drawing cards. Even in this simple case there 287 possible outcomes. I added the 288th case as a reminder that if there are more than one deck the program needs to include more than four cards of each type. In the single deck the probability of the fifth ace is zero so there is no contribution to the expected value.

LIST OF VARIABLES
* Columns D1 through D7 are the value of the dealer cards.
Sum is the sum of values of D1 trough D7.
C is the number of cards the dealer has face up on the table (C=2 through 7)
PERM is short for PERMUT(49,C-1), for C=2 I left it as a fraction, and a percentage after that.
*The second set of columns D2 through D7 is the number of possible cards that were in the deck.
PRODUCT is the product of the columns from the second set of D2 through D7
ODDS = PRODUCT/PERM
19 is the player sum, so it determines a SIGN function = {-1, 0, 1} depending on who wins
WIN = SIGN * ODDS
EXPECTED VALUE = Sum(Win) / Sum(Odds) = 9.4149% / 91.8367% = .102517

H17 or S17 does not matter for this example as a dealer soft 17 is impossible.

Although the individual formulas are straightforward, the table gives you an idea of how many counters you must keep track of in you computer program. Plus all the cases. It gives you new respect for doing this on adding machines in the 1950's before there were digital computers.

In line #1 there are already two 10's out of the deck (the player's 10, and the dealer's initial 10). As the dealer draws another 10 out of the deck, he is choosing from 14 cards.

In line #2 there are already one 9 out of the deck (the player's 9 ). As the dealer draws another 9 out of the deck, he is choosing from 3 cards.

The table is too long for this post, so I left out the middle. If people are interested I can post the spreadsheet on Wiki-commons if they want to download it, but it might be a worthwhile drill to try do your own calculations for the middle.

# D1 D2 D3 D4 D5 D6 D7 Sum C 1/PERM D2 D3 D4 D5 D6 D7 PRODUCT ODDS 19 WIN
1 10 10 20 2 1/49 14 14 28.5714% -1 -28.5714%
2 10 9 19 2 1/49 3 3 6.1224% 0 0.0000%
3 10 8 18 2 1/49 4 4 8.1633% 1 8.1633%
4 10 7 17 2 1/49 4 4 8.1633% 1 8.1633%
5 10 6 10 26 3 4.25E-04 4 14 56 2.3810% 1 2.3810%
6 10 6 9 25 3 4.25E-04 4 3 12 0.5102% 1 0.5102%
7 10 6 8 24 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
8 10 6 7 23 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
9 10 6 6 22 3 4.25E-04 4 3 12 0.5102% 1 0.5102%
10 10 6 5 21 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
11 10 6 4 20 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
12 10 6 3 19 3 4.25E-04 4 4 16 0.6803% 0 0.0000%
13 10 6 2 18 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
14 10 6 1 17 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
15 10 5 10 25 3 4.25E-04 4 14 56 2.3810% 1 2.3810%
16 10 5 9 24 3 4.25E-04 4 3 12 0.5102% 1 0.5102%
17 10 5 8 23 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
18 10 5 7 22 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
19 10 5 6 21 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
20 10 5 5 20 3 4.25E-04 4 3 12 0.5102% -1 -0.5102%
21 10 5 4 19 3 4.25E-04 4 4 16 0.6803% 0 0.0000%
22 10 5 3 18 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
23 10 5 2 17 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
24 10 4 10 24 3 4.25E-04 4 14 56 2.3810% 1 2.3810%
25 10 4 9 23 3 4.25E-04 4 3 12 0.5102% 1 0.5102%
26 10 4 8 22 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
27 10 4 7 21 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
28 10 4 6 20 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
29 10 4 5 19 3 4.25E-04 4 4 16 0.6803% 0 0.0000%
30 10 4 4 18 3 4.25E-04 4 3 12 0.5102% 1 0.5102%
31 10 4 3 17 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
32 10 3 10 23 3 4.25E-04 4 14 56 2.3810% 1 2.3810%
33 10 3 9 22 3 4.25E-04 4 3 12 0.5102% 1 0.5102%
34 10 3 8 21 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
35 10 3 7 20 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
36 10 3 6 19 3 4.25E-04 4 4 16 0.6803% 0 0.0000%
37 10 3 5 18 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
38 10 3 4 17 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
39 10 2 10 22 3 4.25E-04 4 14 56 2.3810% 1 2.3810%
40 10 2 9 21 3 4.25E-04 4 3 12 0.5102% -1 -0.5102%
41 10 2 8 20 3 4.25E-04 4 4 16 0.6803% -1 -0.6803%
42 10 2 7 19 3 4.25E-04 4 4 16 0.6803% 0 0.0000%
43 10 2 6 18 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
44 10 2 5 17 3 4.25E-04 4 4 16 0.6803% 1 0.6803%
45 10 5 1 10 26 4 9.05E-06 4 4 14 224 0.2026% 1 0.2026%
46 10 5 1 9 25 4 9.05E-06 4 4 3 48 0.0434% 1 0.0434%
277 10 2 1 1 1 3 18 6 4.37E-09 4 4 3 2 4 384 1.68E-06 1 1.6781E-06
278 10 2 1 1 1 2 17 6 4.37E-09 4 4 3 2 3 288 1.26E-06 1 1.2586E-06
279 10 2 1 1 1 1 10 26 7 9.93E-11 4 4 3 2 1 14 1344 1.33E-07 1 1.3349E-07
280 10 2 1 1 1 1 9 25 7 9.93E-11 4 4 3 2 1 3 288 2.86E-08 1 2.8604E-08
281 10 2 1 1 1 1 8 24 7 9.93E-11 4 4 3 2 1 4 384 3.81E-08 1 3.8139E-08
282 10 2 1 1 1 1 7 23 7 9.93E-11 4 4 3 2 1 4 384 3.81E-08 1 3.8139E-08
283 10 2 1 1 1 1 6 22 7 9.93E-11 4 4 3 2 1 4 384 3.81E-08 1 3.8139E-08
284 10 2 1 1 1 1 5 21 7 9.93E-11 4 4 3 2 1 4 384 3.81E-08 -1 -3.8139E-08
285 10 2 1 1 1 1 4 20 7 9.93E-11 4 4 3 2 1 4 384 3.81E-08 -1 -3.8139E-08
286 10 2 1 1 1 1 3 19 7 9.93E-11 4 4 3 2 1 4 384 3.81E-08 0 0.0000E+00
287 10 2 1 1 1 1 2 18 7 9.93E-11 4 4 3 2 1 3 288 2.86E-08 1 2.8604E-08
288 10 2 1 1 1 1 1 17 7 9.93E-11 4 4 3 2 1 0 0 0.00E+00 1 0.0000E+00


The probability that the dealer will get beyond five cards is very low, but to get a completely accurate calculation of expected value you need to include all cases. If you are going to do this by Monte Carlo simulation you need a lot of runs to include all of these unlikely cases. If you use more than one deck you will need a tenth case with 7 dealer cards to cover five Aces.

Cards Cases Probability Exp Value
Two 4 55.555556% -0.2400000
Three 40 92.962963% +0.0677291
Four 90 99.487786% +0.1001188
Five 95 99.986638% +0.1024566
Six 49 99.999954% +0.1025171
Seven 9 100.000000% +0.1025174
Last edited by: pacomartin on Feb 9, 2010
Niblick
Niblick
  • Threads: 15
  • Posts: 108
Joined: Dec 12, 2009
February 11th, 2010 at 6:35:21 AM permalink
Excellent.

Thank you very much.
Nemo Omnibus Horis Sapit
dickwilliams
dickwilliams
  • Threads: 4
  • Posts: 13
Joined: Mar 23, 2010
March 25th, 2010 at 4:40:10 PM permalink
How come I don't see dealer blackjack in this table? My calculation seems to say that there are 288 cases for 1 deck, not 287. Please enlighten me.
pacomartin
pacomartin
  • Threads: 649
  • Posts: 7895
Joined: Jan 14, 2010
March 25th, 2010 at 8:36:19 PM permalink
Quote: dickwilliams

How come I don't see dealer blackjack in this table? My calculation seems to say that there are 288 cases for 1 deck, not 287. Please enlighten me.



I was trying to reproduce the tables in Appendix 9 of the Wizard of Odds. Those tables are calculated as separate from the case where the dealer has a blackjack.
dickwilliams
dickwilliams
  • Threads: 4
  • Posts: 13
Joined: Mar 23, 2010
March 25th, 2010 at 11:21:05 PM permalink
Now I'm stuck on doubling. It seems that I am again slightly off. My algorithm for doubling is fairly simple, it's just:


ev = 0

for i from 1 to 10:
probability = (num cards of value i) / (total cards)

add card of value i to player's hand
remove 1 card of value i from the deck
ev += stand( player_hand, dealer_hand, bet * 2 ) * probability
pacomartin
pacomartin
  • Threads: 649
  • Posts: 7895
Joined: Jan 14, 2010
March 25th, 2010 at 11:52:51 PM permalink
You'll find that in a large percentage of cases the EV(double)=2*EV(hit). Try your algorithm and see if it works in this case. These are all cases where if you were to choose to hit , you would only take one card anyway. So doubling just results in double the expected value.

That is not to say that for every case below hitting is the optimal choice. There are several cases where standing is clearly the best choice. However if you were to hit, you would only take one card.

Dealer Player 1 Player 2 sum
3 5 5 10
3 6 4 10
3 7 3 10
3 8 2 10
4 5 5 10
4 6 4 10
4 7 3 10
4 8 2 10
5 5 5 10
5 6 4 10
5 7 3 10
5 8 2 10
6 5 5 10
6 6 4 10
6 7 3 10
6 8 2 10
2 6 5 11
3 6 5 11
3 7 4 11
3 8 3 11
3 9 2 11
4 6 5 11
4 7 4 11
4 8 3 11
4 9 2 11
5 6 5 11
5 7 4 11
5 8 3 11
5 9 2 11
6 6 5 11
6 7 4 11
6 8 3 11
6 9 2 11
2 6 6 12
2 7 5 12
2 8 4 12
2 9 3 12
2 10 2 12
3 6 6 12
3 7 5 12
3 8 4 12
3 9 3 12
3 10 2 12
4 6 6 12
4 7 5 12
4 8 4 12
4 9 3 12
4 10 2 12
5 6 6 12
5 7 5 12
5 8 4 12
5 9 3 12
5 10 2 12
6 6 6 12
6 7 5 12
6 8 4 12
6 9 3 12
6 10 2 12
2 7 6 13
2 8 5 13
2 9 4 13
2 10 3 13
3 7 6 13
3 8 5 13
3 9 4 13
3 10 3 13
4 7 6 13
4 8 5 13
4 9 4 13
4 10 3 13
5 7 6 13
5 8 5 13
5 9 4 13
5 10 3 13
6 7 6 13
6 8 5 13
6 9 4 13
6 10 3 13
2 7 7 14
2 8 6 14
2 9 5 14
2 10 4 14
3 7 7 14
3 8 6 14
3 9 5 14
3 10 4 14
4 7 7 14
4 8 6 14
4 9 5 14
4 10 4 14
5 7 7 14
5 8 6 14
5 9 5 14
5 10 4 14
6 7 7 14
6 8 6 14
6 9 5 14
6 10 4 14
2 8 7 15
2 9 6 15
2 10 5 15
3 8 7 15
3 9 6 15
3 10 5 15
4 8 7 15
4 9 6 15
4 10 5 15
5 8 7 15
5 9 6 15
5 10 5 15
6 8 7 15
6 9 6 15
6 10 5 15
2 8 8 16
2 9 7 16
2 10 6 16
3 8 8 16
3 9 7 16
3 10 6 16
4 8 8 16
4 9 7 16
4 10 6 16
5 8 8 16
5 9 7 16
5 10 6 16
6 8 8 16
6 9 7 16
6 10 6 16
  • Jump to: