December 4th, 2017 at 5:10:52 PM
permalink
I hope someone can pass this on to the author of the Blackjack Hand Calculator on the Wizard of Odds site.
I am currently trying to write a similar engine for a blackjack simulation game and this tool has been extremely valuable for checking my results, sorting out my algorithms, and fixing my bugs. I'd like to offer a big Thank You! I could not have got this far without such a reference.
I agree with your Stand, Hit, and most of the Split figures but I still have some differences. Also I'd like to share an innovation for the Estimated split hand calculation, I would appreciate a second opinion on whether it is valid or useful.
First the split calculation. The results that agree do so to 6 significant figures so I imagine that you're using the same methods as me, those outlined by Profs. Griffin and Nairn.
The first difference is if the dealer peeks for blackjack and the upcard is a ten or ace, for 2 or 4 maximum hands. I think you’re correctly applying the ‘dealer peeks’ probability weightings when playing the hand, but not when you deal the second card to a split hand. When I implement this behavior in my own program it matches your results so I think it’s that. See the table below showing my results for splitting if you wish to sample them, parameters are listed at the top. The 3 sets of rows represent a maximum of 2,3,4 hands respectively.
The second difference is that none of the values for splitting to 3 hands agree exactly, although they're close to a percent or so. I can't figure out what it is I am doing wrong.
Now to my innovation. First I'll recap some of Prof. Griffin's method, to check if my understand of it is correct.
When examining the outcomes for splitting where resplitting is allowed we have to divide the outcomes into distinct categories depending on how many split hands there were, this is because of the differences in deck composition and order, so if there are 4 hands maximum and we’re splitting eights, using Griffin and Nairn’s, notation we can calculate these outcomes as follows:
For E(2) we remove 2 eights from the deck as these are known to be dealt to the player. We assume the second card dealt to a split hand cannot be an eight. (If it were there would be more than 2 hands)
For E(3) we remove 3 eights from the deck. We assume the 'second card' cannot be an eight (as above).
For E(4) we remove 4 eights from the deck, and the 'second card' can be any value.
The innovation I’d like to suggest involves the E(4) calculation, there are different E(4) outcomes that determine how we treat the second card.
Below the ’Combination’ on the left is the sequence of cards dealt after the initial 2 split cards that result in the split hands on the right showing the first and second cards.
Key:
s = a card of the same value as the split card.
n = a card not of the same value as the split card.
x = any card
As you can see there are 3 different E(4) outcomes that should be treated differently. We were previously assuming that the 4 hands are always ‘s x’. We're of course assuming that there are 2 or more decks in the shoe, otherwise it would make no difference as the 'split' cards are exhausted.
Also note that with maximum of 3 hands there are 2 distinct E(3) outcomes.
To explain, I’ve separated distinct outcomes, for example ‘nsns’ is distinct from ‘nsnn’ because the latter would result in only 3 hands, because of this we have to look at what we know about the outcome of ‘nsns’, including the fact that it yields 2 out of 4 ‘n’ second cards.
The calculation of expected value given by Griffin looks something like below;
The calculation in my code looks like this.
Where, for example pE4n is the calculation of E(4) omitting the 's' card as the second card in the hand, pE4x is the same but allowing it.
The variables beginning pP4 are the probabilities of the 3 hand outcomes in my explanation.
I should add that the results given in my table use Griffin's formula, not the code above, so as to be comparable with your own results.
E(4) is a small part of the result calculation and this innovation changes the overall EV by a few parts of the 4th decimal place, so even if it is valid there’s no need to change the strategy cards, and it’s probably smaller than our estimation inaccuracy. However I think it's good to include in our method everything that is known.
Thank you very much for reading and I'd greatly appreciate any comments.
I am currently trying to write a similar engine for a blackjack simulation game and this tool has been extremely valuable for checking my results, sorting out my algorithms, and fixing my bugs. I'd like to offer a big Thank You! I could not have got this far without such a reference.
I agree with your Stand, Hit, and most of the Split figures but I still have some differences. Also I'd like to share an innovation for the Estimated split hand calculation, I would appreciate a second opinion on whether it is valid or useful.
First the split calculation. The results that agree do so to 6 significant figures so I imagine that you're using the same methods as me, those outlined by Profs. Griffin and Nairn.
The first difference is if the dealer peeks for blackjack and the upcard is a ten or ace, for 2 or 4 maximum hands. I think you’re correctly applying the ‘dealer peeks’ probability weightings when playing the hand, but not when you deal the second card to a split hand. When I implement this behavior in my own program it matches your results so I think it’s that. See the table below showing my results for splitting if you wish to sample them, parameters are listed at the top. The 3 sets of rows represent a maximum of 2,3,4 hands respectively.
TABLE OF SPLIT HAND ESTIMATED VALUES
PARAMETERS: Peeks=true HS17=false Draw2splitA=true Decks=2 Max.Recursion Level=10 E(n) refinement=false
,----------------------------------------------------------------------------------------------------------------------.
|Hand | Dealer A | Dealer 2 | Dealer 3 | Dealer 4 | Dealer 5 |
| | | | | | |
| | NDAS DAS | NDAS DAS | NDAS DAS | NDAS DAS | NDAS DAS |
|======================================================================================================================|
| A,A x2 | +0.615693 +0.615693 | +0.762476 +0.762774 | +0.798006 +0.807013 | +0.837359 +0.868994 | +0.887389 +0.953979 |
| x3 | +0.678016 +0.678016 | +0.840809 +0.841215 | +0.877731 +0.887756 | +0.918829 +0.954651 | +0.970624 +1.044681 |
| x4 | +0.684784 +0.684784 | +0.851257 +0.851687 | +0.888332 +0.898499 | +0.929625 +0.966097 | +0.981596 +1.056609 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 2,2 x2 | -0.416885 -0.416717 | -0.140722 -0.066852 | -0.084518 +0.001401 | -0.021333 +0.077757 | +0.075500 +0.196387 |
| x3 | -0.435784 -0.435332 | -0.143266 -0.061807 | -0.084936 +0.011363 | -0.019090 +0.091861 | +0.084221 +0.219955 |
| x4 | -0.437980 -0.437458 | -0.143428 -0.061104 | -0.084882 +0.012868 | -0.018749 +0.093847 | +0.085495 +0.223332 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 3,3 x2 | -0.464880 -0.463421 | -0.200175 -0.127839 | -0.131309 -0.044814 | -0.032921 +0.071069 | +0.055614 +0.182481 |
| x3 | -0.481361 -0.479455 | -0.206158 -0.125147 | -0.132949 -0.037814 | -0.028172 +0.088540 | +0.065704 +0.208124 |
| x4 | -0.483010 -0.481013 | -0.206704 -0.124489 | -0.132984 -0.036887 | -0.027276 +0.091232 | +0.067297 +0.211959 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 4,4 x2 | -0.525748 -0.522853 | -0.230667 -0.157469 | -0.145101 -0.055323 | -0.057870 +0.051753 | +0.032085 +0.162789 |
| x3 | -0.564155 -0.560617 | -0.255450 -0.173457 | -0.162364 -0.061664 | -0.068438 +0.052538 | +0.025149 +0.171993 |
| x4 | -0.569136 -0.565475 | -0.258788 -0.175573 | -0.164545 -0.062312 | -0.069529 +0.052752 | +0.024251 +0.173408 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 5,5 x2 | -0.599731 -0.595172 | -0.244071 -0.175406 | -0.170112 -0.087434 | -0.083080 +0.017276 | +0.006778 +0.127026 |
| x3 | -0.681124 -0.675671 | -0.294002 -0.240722 | -0.213910 -0.148493 | -0.120150 -0.038750 | -0.019285 +0.083108 |
| x4 | -0.692476 -0.686861 | -0.300844 -0.250011 | -0.219895 -0.157227 | -0.125239 -0.046875 | -0.022228 +0.077872 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 6,6 x2 | -0.623969 -0.619154 | -0.252332 -0.174934 | -0.176803 -0.079488 | -0.089939 +0.026702 | -0.003579 +0.136739 |
| x3 | -0.653825 -0.648015 | -0.249658 -0.162357 | -0.168057 -0.058411 | -0.076444 +0.055021 | +0.014455 +0.172440 |
| x4 | -0.657285 -0.651286 | -0.248591 -0.159842 | -0.166298 -0.054859 | -0.074073 +0.059554 | +0.017372 +0.177912 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 7,7 x2 | -0.615971 -0.613467 | -0.191524 -0.115716 | -0.119187 -0.026464 | -0.036668 +0.079975 | +0.012595 +0.146164 |
| x3 | -0.630828 -0.627782 | -0.179909 -0.094452 | -0.103621 +0.000943 | -0.017061 +0.114333 | +0.032254 +0.181428 |
| x4 | -0.631771 -0.628620 | -0.177783 -0.090918 | -0.100958 +0.005336 | -0.013927 +0.119609 | +0.035101 +0.186394 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 8,8 x2 | -0.367828 -0.367614 | -0.015171 +0.052391 | +0.046770 +0.122206 | +0.092243 +0.176686 | +0.165339 +0.259895 |
| x3 | -0.350416 -0.350117 | +0.017078 +0.092706 | +0.081469 +0.165954 | +0.126586 +0.220602 | +0.202640 +0.307916 |
| x4 | -0.347205 -0.346896 | +0.021962 +0.098706 | +0.086651 +0.172394 | +0.131432 +0.226711 | +0.207810 +0.314502 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 9,9 x2 | -0.102473 -0.102473 | +0.159542 +0.193813 | +0.188392 +0.228919 | +0.254659 +0.299621 | +0.326639 +0.376614 |
| x3 | -0.102555 -0.102555 | +0.163797 +0.202048 | +0.192793 +0.237770 | +0.263130 +0.313073 | +0.339954 +0.395492 |
| x4 | -0.102210 -0.102210 | +0.164272 +0.203058 | +0.193030 +0.238573 | +0.263892 +0.314480 | +0.341327 +0.397588 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| T,T x2 | +0.131546 +0.131546 | +0.339997 +0.339997 | +0.388890 +0.388890 | +0.443019 +0.443019 | +0.504865 +0.504865 |
| x3 | -0.088056 -0.088056 | +0.221563 +0.221563 | +0.287633 +0.287633 | +0.362873 +0.362873 | +0.444564 +0.444564 |
| x4 | -0.229921 -0.229921 | +0.139070 +0.139070 | +0.215520 +0.215520 | +0.302530 +0.302530 | +0.396445 +0.396445 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
,----------------------------------------------------------------------------------------------------------------------.
|Hand | Dealer 6 | Dealer 7 | Dealer 8 | Dealer 9 | Dealer T |
| | | | | | |
| | NDAS DAS | NDAS DAS | NDAS DAS | NDAS DAS | NDAS DAS |
|======================================================================================================================|
| A,A x2 | +0.930806 +1.020376 | +0.923470 +0.923470 | +0.813905 +0.813905 | +0.656051 +0.656051 | +0.529145 +0.529145 |
| x3 | +1.015949 +1.113737 | +1.011335 +1.011335 | +0.897510 +0.897510 | +0.732516 +0.732516 | +0.597554 +0.597554 |
| x4 | +1.027072 +1.125905 | +1.022900 +1.022900 | +0.908652 +0.908652 | +0.742850 +0.742850 | +0.606918 +0.606918 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 2,2 x2 | +0.101677 +0.236220 | -0.053826 -0.000919 | -0.208835 -0.174934 | -0.381615 -0.362343 | -0.471715 -0.463166 |
| x3 | +0.112385 +0.263635 | -0.049596 +0.010068 | -0.215279 -0.176877 | -0.398670 -0.376596 | -0.494113 -0.484460 |
| x4 | +0.113935 +0.267599 | -0.048899 +0.011754 | -0.215907 -0.176828 | -0.400601 -0.378079 | -0.496771 -0.486956 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 3,3 x2 | +0.079192 +0.217490 | -0.115501 -0.062603 | -0.264662 -0.229149 | -0.425362 -0.407063 | -0.518465 -0.508830 |
| x3 | +0.090596 +0.246351 | -0.109414 -0.049687 | -0.268171 -0.227845 | -0.439590 -0.418856 | -0.539115 -0.528248 |
| x4 | +0.092379 +0.250663 | -0.108177 -0.047444 | -0.268122 -0.227062 | -0.440992 -0.419894 | -0.541376 -0.530329 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 4,4 x2 | +0.052192 +0.192662 | -0.197597 -0.141848 | -0.329892 -0.292585 | -0.486623 -0.467172 | -0.574088 -0.563784 |
| x3 | +0.043738 +0.201147 | -0.232639 -0.169611 | -0.362785 -0.320688 | -0.519747 -0.497694 | -0.613004 -0.601399 |
| x4 | +0.042585 +0.202222 | -0.237670 -0.173529 | -0.367301 -0.324502 | -0.523978 -0.501538 | -0.617983 -0.606190 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 5,5 x2 | +0.026841 +0.161312 | -0.266939 -0.214812 | -0.409924 -0.374661 | -0.567845 -0.548159 | -0.647359 -0.637116 |
| x3 | -0.004743 +0.107720 | -0.331041 -0.292377 | -0.483360 -0.456563 | -0.649601 -0.633032 | -0.727992 -0.716415 |
| x4 | -0.009218 +0.099703 | -0.340376 -0.303916 | -0.493892 -0.468512 | -0.661089 -0.645095 | -0.739177 -0.727406 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 6,6 x2 | -0.016361 +0.133284 | -0.289078 -0.231642 | -0.425245 -0.387115 | -0.578573 -0.558551 | -0.664372 -0.654363 |
| x3 | -0.002375 +0.162078 | -0.294082 -0.229649 | -0.439764 -0.396845 | -0.603679 -0.581062 | -0.696807 -0.685545 |
| x4 | -0.000671 +0.165418 | -0.294240 -0.228821 | -0.441190 -0.397580 | -0.606510 -0.583510 | -0.700561 -0.689122 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 7,7 x2 | +0.058321 +0.201342 | -0.130546 -0.078299 | -0.423697 -0.388898 | -0.568627 -0.552038 | -0.635074 -0.624217 |
| x3 | +0.083352 +0.243018 | -0.108235 -0.051047 | -0.427138 -0.388263 | -0.581606 -0.563065 | -0.651079 -0.638742 |
| x4 | +0.086916 +0.248833 | -0.105359 -0.047648 | -0.426892 -0.387460 | -0.582550 -0.563739 | -0.652417 -0.639856 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 8,8 x2 | +0.231878 +0.332625 | +0.184075 +0.231816 | -0.109412 -0.079889 | -0.423635 -0.404886 | -0.480114 -0.470579 |
| x3 | +0.277078 +0.389284 | +0.249920 +0.302706 | -0.078186 -0.046192 | -0.417642 -0.396553 | -0.475957 -0.465213 |
| x4 | +0.283349 +0.397077 | +0.259211 +0.312620 | -0.074476 -0.042253 | -0.416431 -0.395003 | -0.474781 -0.463860 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| 9,9 x2 | +0.377062 +0.429729 | +0.342372 +0.366775 | +0.187257 +0.204642 | -0.108256 -0.098187 | -0.285394 -0.278043 |
| x3 | +0.387671 +0.446209 | +0.336178 +0.362977 | +0.199312 +0.218509 | -0.100664 -0.089773 | -0.300657 -0.292554 |
| x4 | +0.388569 +0.447871 | +0.334810 +0.361880 | +0.200892 +0.220309 | -0.099669 -0.088704 | -0.302565 -0.294373 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
| T,T x2 | +0.549495 +0.549495 | +0.498351 +0.498351 | +0.374847 +0.374847 | +0.208339 +0.208339 | +0.055227 +0.055227 |
| x3 | +0.499588 +0.499588 | +0.402299 +0.402299 | +0.215000 +0.215000 | -0.012273 -0.012273 | -0.151903 -0.151903 |
| x4 | +0.457494 +0.457494 | +0.335501 +0.335501 | +0.110220 +0.110220 | -0.152629 -0.152629 | -0.278496 -0.278496 |
|--------+---------------------+---------------------+---------------------+---------------------+---------------------|
The second difference is that none of the values for splitting to 3 hands agree exactly, although they're close to a percent or so. I can't figure out what it is I am doing wrong.
Now to my innovation. First I'll recap some of Prof. Griffin's method, to check if my understand of it is correct.
When examining the outcomes for splitting where resplitting is allowed we have to divide the outcomes into distinct categories depending on how many split hands there were, this is because of the differences in deck composition and order, so if there are 4 hands maximum and we’re splitting eights, using Griffin and Nairn’s, notation we can calculate these outcomes as follows:
For E(2) we remove 2 eights from the deck as these are known to be dealt to the player. We assume the second card dealt to a split hand cannot be an eight. (If it were there would be more than 2 hands)
For E(3) we remove 3 eights from the deck. We assume the 'second card' cannot be an eight (as above).
For E(4) we remove 4 eights from the deck, and the 'second card' can be any value.
The innovation I’d like to suggest involves the E(4) calculation, there are different E(4) outcomes that determine how we treat the second card.
Below the ’Combination’ on the left is the sequence of cards dealt after the initial 2 split cards that result in the split hands on the right showing the first and second cards.
Key:
s = a card of the same value as the split card.
n = a card not of the same value as the split card.
x = any card
Max hands = 2 (no resplitting)
Combination Resulting
(following ‘ss’) Hands
xx Hand 1: s x
Hand 2: s x
Max hands = 3 (2 splits allowed)
Combination Resulting
(following ‘ss’) Hands
nn Hand 1: s n
hand 2: s n
ns Hand 1: s n
Hand 2: s x
Hand 3: s x
sx Hand 1: s x
Hand 2: s x
Hand 3: s x
Max hands = 4 (3 splits allowed)
Combination Resulting
(following ‘ss’) Hands
nnxx Hand 1: s n
Hand 2: s n
nsnn, snnn hand 1: s n
Hand 2: s n
Hand 3: s n
nsns, snns Hand 1: s n
Hand 2: s n
Hand 3: s x
Hand 4: s x
nssx, snsx Hand 1: s n
Hand 2: s x
Hand 3: s x
Hand 4: s x
ssxx hand 1: s x
Hand 2: s x
Hand 3: s x
Hand 4: s x
As you can see there are 3 different E(4) outcomes that should be treated differently. We were previously assuming that the 4 hands are always ‘s x’. We're of course assuming that there are 2 or more decks in the shoe, otherwise it would make no difference as the 'split' cards are exhausted.
Also note that with maximum of 3 hands there are 2 distinct E(3) outcomes.
To explain, I’ve separated distinct outcomes, for example ‘nsns’ is distinct from ‘nsnn’ because the latter would result in only 3 hands, because of this we have to look at what we know about the outcome of ‘nsns’, including the fact that it yields 2 out of 4 ‘n’ second cards.
The calculation of expected value given by Griffin looks something like below;
E = {P(2) * 2 * E(2)} + {P(3) * 3 * E(3)} + {P(4) * 4 * E(4)}
The calculation in my code looks like this.
pEs = (pP2 * 2 * pE2n) + (pP3 * 3 * pE3n) + (pP4nnxx * 2 * pE4n) + (pP4nnxx * 2 * pE4x)
+ (pP4nxxx * 1 * pE4n) + (pP4nxxx * 3 * pE4x)
+ (pP4xxxx * 4 * pE4x);
Where, for example pE4n is the calculation of E(4) omitting the 's' card as the second card in the hand, pE4x is the same but allowing it.
The variables beginning pP4 are the probabilities of the 3 hand outcomes in my explanation.
I should add that the results given in my table use Griffin's formula, not the code above, so as to be comparable with your own results.
E(4) is a small part of the result calculation and this innovation changes the overall EV by a few parts of the 4th decimal place, so even if it is valid there’s no need to change the strategy cards, and it’s probably smaller than our estimation inaccuracy. However I think it's good to include in our method everything that is known.
Thank you very much for reading and I'd greatly appreciate any comments.
Last edited by: tmcneil on Dec 4, 2017