Gains from perfect insurance

London Colin

Well-Known Member
#1
I've been working on a program to calculate the gains from perfect playing and insurance strategy at a given depth.

I've been cross-checking my insurance results with the table in chapter 6 of The Theory of Blackjack, and found some slight discrepancies. It may be that I have an error in my code, or it may be just an issue of rounding.

(The TOBJ table gives figures in 1/100ths of a %; most are integers, but some are to one decimal place, which would seem to imply that the integer ones are accurate to the same level, but with the trailing '.0' omitted for brevity. But maybe not? :confused:)

At any rate, does anybody have access to an alternative source for these figures, ideally to more decimal places, so that I can know for sure when I have got my program producing the right answers?

So far, what I have seen is -

Code:
[B]Single deck:[/B]

[B]Cards Left       TOBJ        Me[/B]
47               1.7         1.7146
46               2.3         2.31098
44               4           3.99169
41               6           6.33756

29               17          15.66681[B]*[/B]
The first three of the above would be correct if rounded to 1dp, but I would expect the fourth to be shown as 6.3 in TOBJ if my figure was correct, suggesting I may have an error.

*The last figure definitely implies a problem. However, I got it via some hasty, manual calculations after I discovered that I get an integer overflow within my code at that level. So I can't rely on this figure until I sort that issue out; I may have screwed something up.

Thanks,
 

k_c

Well-Known Member
#2
London Colin said:
I've been working on a program to calculate the gains from perfect playing and insurance strategy at a given depth.

I've been cross-checking my insurance results with the table in chapter 6 of The Theory of Blackjack, and found some slight discrepancies. It may be that I have an error in my code, or it may be just an issue of rounding.

(The TOBJ table gives figures in 1/100ths of a %; most are integers, but some are to one decimal place, which would seem to imply that the integer ones are accurate to the same level, but with the trailing '.0' omitted for brevity. But maybe not? :confused:)

At any rate, does anybody have access to an alternative source for these figures, ideally to more decimal places, so that I can know for sure when I have got my program producing the right answers?

So far, what I have seen is -

Code:
[B]Single deck:[/B]

[B]Cards Left       TOBJ        Me[/B]
47               1.7         1.7146
46               2.3         2.31098
44               4           3.99169
41               6           6.33756

29               17          15.66681[B]*[/B]
The first three of the above would be correct if rounded to 1dp, but I would expect the fourth to be shown as 6.3 in TOBJ if my figure was correct, suggesting I may have an error.

*The last figure definitely implies a problem. However, I got it via some hasty, manual calculations after I discovered that I get an integer overflow within my code at that level. So I can't rely on this figure until I sort that issue out; I may have screwed something up.

Thanks,
I have a program that computes probabilities relative to a given count given number of cards remaining to be dealt, a running count, and optionally cards specifically known to be removed. I input the insurance count into the program. Below is program output for single deck insurance count with 47 cards remaining at a running count of +1. Only possible running counts with 47 cards remaining and an ace up card specifically removed are -11, -8, -5, -2, and +1. Insurance is only positive EV when running count is greater than 0 for the insurance count so for the case of 47 cards left we only need to figure RC = +1.

Code:
Count tags {-1,-1,-1,-1,-1,-1,-1,-1,-1,2}
Decks: 1
Cards remaining: 47
Initial running count (full shoe): -4
Running count: 1
Specific removals
        A: 1
        2: 0
        3: 0
        4: 0
        5: 0
        6: 0
        7: 0
        8: 0
        9: 0
        T: 0

Number of subsets for 47 cards: 6
Prob of running count 1 from 1 deck: 0.209524

p[1] 0.056535  p[2] 0.0753799  p[3] 0.0753799  p[4] 0.0753799  p[5] 0.0753799
p[6] 0.0753799  p[7] 0.0753799  p[8] 0.0753799  p[9] 0.0753799  p[10] 0.340426

Press x or X to exit program (it may take some time to close,)
any other key to enter more data for same count tags/decks:
OK to compute insurance EV from the program's output notice that prob of count = .209524 and prob of ten (p[10]) = .340426.

If up card is ace and p[10] = .340426 then ins EV (based on 1/2 initial wager)
= (3*.340426-1)/2 * (prob of count) * (prob of ace from full shoe)
= (3*.340426-1)/2 * (.209524) * (1/13) = .00017147

This is in agreement with what you got but there is rounding error.
Exact calculation is 4/52*35/51*34/50*33/49*32/48*(3*16/47-1)/2
= 1.7145974592783103421401293741719e-4

For 29 cards remaining to be dealt there are 7 possible counts that yield positive insurance EV given an ace is specifically removed to allow for up card.

Code:
[u]Count[/u]  [u]Prob of count[/u]  [u]p[10][/u]        [u]Insurance EV[/u]
+19    9.45902e-006   0.551724	   0.327586	  (13 NT, 16 T)
+16    0.000237827    0.517241	   0.2758615	  (14 NT, 15 T)
+13    0.00249718     0.482759	   0.2241385	  (15 NT, 14 T)
+10    0.0145669      0.448276	   0.172414	  (16 NT, 13 T)
+7     0.0529121      0.413793	   0.1206895	  (17 NT, 12 T)
+4     0.126989	      0.37931	   0.068965	  (18 NT, 11 T)
+1     0.208307	      0.344828	   0.017242	  (19 NT, 10 T)
You might want to check my math and there could be a bit of rounding error but the result I get is
Ins EV (29 cards) = 0.001682717 = .1682717%
 

London Colin

Well-Known Member
#3
Thanks for that, k_c.
k_c said:
You might want to check my math and there could be a bit of rounding error but the result I get is
Ins EV (29 cards) = 0.001682717 = .1682717%
I'm sure that will prove correct, as it tallies with the figure in TOBJ.

Would you mind calculating the figure for 41 cards. That's the first one I generated with a possible discrepancy. And, as I said, my 29-card figure may have been wrong for different reasons.

(And, actually, your 29-card figure has a similar discrepancy with the book, in that I would expect it to be written as 16.8, rather than 17. So there is some hope that you may get the same figure as me for 41 cards.)


Thanks again,
 

k_c

Well-Known Member
#4
London Colin said:
Thanks for that, k_c.

I'm sure that will prove correct, as it tallies with the figure in TOBJ.

Would you mind calculating the figure for 41 cards. That's the first one I generated with a possible discrepancy. And, as I said, my 29-card figure may have been wrong for different reasons.

(And, actually, your 29-card figure has a similar discrepancy with the book, in that I would expect it to be written as 16.8, rather than 17. So there is some hope that you may get the same figure as me for 41 cards.)


Thanks again,
For 41 cards it's not that hard to compute exactly.

There are 3 subsets that yield positive ins EV given up card of ace:

25 non-tens, 16 tens
Prob_1=35/51*34/50*33/49*32/48*31/47*30/46*29/45*28/44*27/43*26/42
PBJ_1=16/41

26 non-tens, 15 tens
Prob_2=35/51*34/50*33/49*32/48*31/47*30/46*29/45*28/44*27/43*16/42*10
PBJ_2=15/41

27 non-tens, 14 tens
Prob_3=35/51*34/50*33/49*32/48*31/47*30/46*29/45*28/44*16/43*15/42*45
PBJ_3=14/41

Ins EV = [Prob_1*(3*PBJ_1-1)/2 + Prob_2*(3*PBJ_2-1)/2 + Prob_3*(3*PBJ_3-1)/2] * 4/52

Ins EV = 6.33448772737041E-04
(If I didn't make any mistakes) :grin:
 

London Colin

Well-Known Member
#5
I'm an idiot

k_c said:
Ins EV = 6.33448772737041E-04
(If I didn't make any mistakes) :grin:
Apologies. I actually did already get the same answer as you for that. But when I came to write it up, I picked out the wrong number from my notes, one from an earlier attempt which featured a small bug.

So things are looking good. Importantly, your results seem to have confirmed my suspicion that the rounding applied to the figures in the TOBJ table is somewhat random.

I just need to sort out the problem at the 29-card level now. (Though it's largely academic: The full program computes gains from both insurance and strategy variations. The strategy part takes a loooong time. It took a couple of days to complete for the 41-card level. I doubt it would be possible to go much deeper and get an answer in my lifetime.:)

Thanks for your help.
 

London Colin

Well-Known Member
#6
All fixed

Looks like I've tracked down all the remaining bugs. If it's of any use to anyone, here's the full list of results for 1 deck -

Code:
Cards left: 1   Ins EV: 0.0241327
Cards left: 2   Ins EV: 0.0156863
Cards left: 3   Ins EV: 0.00982547
Cards left: 4   Ins EV: 0.00982547
Cards left: 5   Ins EV: 0.00853952
Cards left: 6   Ins EV: 0.00675038
Cards left: 7   Ins EV: 0.00675038
Cards left: 8   Ins EV: 0.00616213
Cards left: 9   Ins EV: 0.00520451
Cards left: 10  Ins EV: 0.00520451
Cards left: 11  Ins EV: 0.00484511
Cards left: 12  Ins EV: 0.00421615
Cards left: 13  Ins EV: 0.00421615
Cards left: 14  Ins EV: 0.00396406
Cards left: 15  Ins EV: 0.00350348
Cards left: 16  Ins EV: 0.00350348
Cards left: 17  Ins EV: 0.00331157
Cards left: 18  Ins EV: 0.00295034
Cards left: 19  Ins EV: 0.00295034
Cards left: 20  Ins EV: 0.002796
Cards left: 21  Ins EV: 0.00249872
Cards left: 22  Ins EV: 0.00249872
Cards left: 23  Ins EV: 0.00236956
Cards left: 24  Ins EV: 0.00211584
Cards left: 25  Ins EV: 0.00211584
Cards left: 26  Ins EV: 0.00200435
Cards left: 27  Ins EV: 0.00178138
Cards left: 28  Ins EV: 0.00178138
Cards left: 29  Ins EV: 0.00168271
Cards left: 30  Ins EV: 0.00148179
Cards left: 31  Ins EV: 0.00148179
Cards left: 32  Ins EV: 0.0013926
Cards left: 33  Ins EV: 0.00120741
Cards left: 34  Ins EV: 0.00120741
Cards left: 35  Ins EV: 0.00112531
Cards left: 36  Ins EV: 0.000950845
Cards left: 37  Ins EV: 0.000950845
Cards left: 38  Ins EV: 0.000874082
Cards left: 39  Ins EV: 0.000706021
Cards left: 40  Ins EV: 0.000706021
Cards left: 41  Ins EV: 0.000633449
Cards left: 42  Ins EV: 0.00046757
Cards left: 43  Ins EV: 0.00046757
Cards left: 44  Ins EV: 0.000399169
Cards left: 45  Ins EV: 0.000231098
Cards left: 46  Ins EV: 0.000231098
Cards left: 47  Ins EV: 0.00017146
Thanks again for the help, k_c.
 
Top