loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 27th, 2011 at 11:22:02 AM permalink
I have seen the chart that shows the odds of the dealer busting based on each up card. What I want to know is how to actually calculate it. Just to clarify, this is eventual bust, not bust on next card. Also I will assume dealer hits on soft 17.

I then want to be able to calculate the dealer bust odds based on all up cards on the table.

I can do some computer programming. And I know I could brute force it. But looking at all possible combinations for multiple decks would take way too long. So I am hoping to find some short cuts, or maybe it is simpler then I think it is.

I have looked and looked on the Wizards main site but have only found the chart, not the how.

Thanks for any help as I have been searching for weeks.

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 27th, 2011 at 1:19:35 PM permalink
Get my spreadsheet file S17.xls from http://www.blackjackinfo.com/bb/showpost.php?p=222208&postcount=5 and read instruction therein.
It's easy to use, and will give you probabilities of dealer busting based on a infinite deck
ironically the infinite deck is much more simpler to compute than the finite deck, and can be done in a spread sheet.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 28th, 2011 at 12:16:45 AM permalink
Thanks, very much. So far that file looks simple and easy to use. And the numbers it gives are close to the known charts. Probably because of the infinite assumption. I know infinite decks is easier, as then you are back to straight 1 in 52 odds for each card, or 1 in 13 for each card type.

I just need to understand why you do stacking of add the previous cells skipping the one just below, after adding those, then divide by 13. Then that changes at hard 11 to hard 12. Well, maybe if I read the thread when I am more awake it will be clear.

Thanks again, this file alone is a great help. And I am impressed.

Keith
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 28th, 2011 at 12:56:55 AM permalink
Without simulation I would calculate Dealer bust probability recursively by starting from the end result and moving back to start.

Let P(N) be the probability that dealer busts from total of N.

P(17) ... P(21) = 0, since dealer stands
P(16) = 5/13*0 + 8/13*1 = 8/13
P(15) = 1/13*P(16) + 5/13*0 + 7/13*1 = 99/169
P(14) = 1/13*P(15) + 1/13*P(16) + 5/13*0 + 6/13*1 = 0.553937
P(13) = ...

and work backwards using previous values until you get down to P(1) ... P(10) = dealers upcard. Of course you have to take into account soft hands as well. And if you calculate this for limited number of decks you'd need to modify the fractions 1/13, 2/13 ... because there is not exactly a 1/13 chance to draw each rank because of previous cards drawn from the shoe.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 28th, 2011 at 12:38:06 PM permalink
Well, I understand that. And it seems to make sense. With 16, we have eight out of 13 that will cause a bust, the rest will be a dealer stand. And for a total of 15, there is one more card, so multiply that by P(16), and add the seven out of 13 that will bust.

I put it into excel and got this -

9 0.3538707
10 0.400022793
11 0.442878307
12 0.482672714
13 0.519624663
14 0.553937187
15 0.585798817
16 0.615384615

I stopped at 9, because for eight the final add would have been 0/13, also I only needed down to 10 to check the known charts. And for 9 and 10 in the known bust charts we have - 9= .2334 , 10= .2143. That is way different then what I got with the above method. Did I do something wrong? Or is the above formula wrong? Even for infinite decks it wouldn't be this far off.

Otherwise it is a great idea. And I hope some one can figure it out.

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 28th, 2011 at 1:34:49 PM permalink
Quote: loveTheOdds


I just need to understand why you do stacking of add the previous cells skipping the one just below, after adding those, then divide by 13. Then that changes at hard 11 to hard 12. Well, maybe if I read the thread when I am more awake it will be clear.



Those are drawing Aces. Drawing an Ace on a hard 8 turns the hand into a soft 9. However drawing an Ace on a hard 11 turns the hand into a hard 12.

Those sums in the spreadsheet cells is a reversed probability tree. To reach a hard 16, you can draw an Ace on a hard 15, a Deuce on a hard 14, ... a Ten on a hard 6. And a Ten from a soft 16.
Hence, the probability of reaching hard 16 is the probability of having a hard 15 (some cell) times the probability of drawing an Ace (1/13), plus the probability of having hard 14 (some other cell) times the probability of drawing a Deuce (again 1/13). This is a long formula which would look like
H16 = H15 * 1/13 + H14 * 1/13 + ... + H6 * 4/13 + S16 * 4/13.
The common factor 1/13 is pulled out of the sum, and gets

H16 = (H15 + H14 + ... + 4*H6 + 4*S16) / 13

This is done for every possible hard and soft hand. You see this is very simple and systematically. Those equations and cells turn out to be recursive! But spreadsheet applications are very strong with recursive cell references. All you need to do is provide an initial value (this is the value of 1.0 you enter beforehand), and Excel will solve those recursive cell values in a split second.
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 28th, 2011 at 1:34:51 PM permalink
Quote: loveTheOdds


I put it into excel and got this -

9 0.3538707
10 0.400022793
11 0.442878307
12 0.482672714
13 0.519624663
14 0.553937187
15 0.585798817
16 0.615384615

I stopped at 9, because for eight the final add would have been 0/13, also I only needed down to 10 to check the known charts. And for 9 and 10 in the known bust charts we have - 9= .2334 , 10= .2143. That is way different then what I got with the above method. Did I do something wrong? Or is the above formula wrong? Even for infinite decks it wouldn't be this far off.

Otherwise it is a great idea. And I hope some one can figure it out.

Keith



Your values are correct from 16 to 12, but you got 11 to 9 wrong. P(11) = 1/13*(P(12)+P(13)+P(14)+P(15)+P(16)) + 8/13*0 = 0.212109 and not 0.442878307. With a total of 11 dealer always stands unless the next card is A,2,3,4 or 5, so 8 out of 13 times. The next few correct values are recursively:

P(11) = 1/13*(P(12)+P(13)+P(14)+P(15)+P(16)) + 8/13*0 = 0.212109077
P(10) = 1/13*(P(11) + ... + P(16)) + 7/13*0 = 0.228425159
P(9) = 0.245996326
P(8) = 0.26491912
work out the rest on your own!

Now these values are closer what you expect but we still haven't taken into account soft hands. The above calculation assumes that Ace always has a value of 1, so that if Ten is followed by Ace, it becomes a total of 11 and can bust which is obviously not the case as it is a 21/blackjack. It looks like MangoJ's spreadsheet and explanation above addresses this.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 28th, 2011 at 1:53:25 PM permalink
Quote: Jufo81

Without simulation I would calculate Dealer bust probability recursively by starting from the end result and moving back to start.

Let P(N) be the probability that dealer busts from total of N.

P(17) ... P(21) = 0, since dealer stands
P(16) = 5/13*0 + 8/13*1 = 8/13
P(15) = 1/13*P(16) + 5/13*0 + 7/13*1 = 99/169



You are right. This is generaly what the spreadsheet does. However you will need to distinguish between hard and soft hands. And then things get more complicated, but in essence it is identically to your ansatz.

With exact probabilities from a finite deck: Things are entirely different. You know need to take into account the number of remaining cards of all values. But this also depend on the composition of your "N". A P(10+6) is different from a P(8+8). You would need one equation for each possible hand combination. Think of how many combinations you can form a hard 16 and all other hands ? It's possible, and it's a couple of thousand different P's. And each of those thousand P's will depend on other thousands P's in the way you described above.
In short: It can be done (and has already been done). You would simply write a small computer programm to sum up all those different compositions and probabilities.


Another ansatz would be "forward": draw every possible hand combination into the deck exhaustively and sum up the probabilities of busting. Of course this would be done recursively. Both approaches are equivalent, and yield the same outcome.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 28th, 2011 at 2:28:59 PM permalink
Thanks to both of you two. Very, very helpful.

I redid Jufo's calc and got -

2 0.413258128
3 0.38373969
4 0.356329712
5 0.33087759
6 0.307243476
7 0.285297514
8 0.26491912
9 0.245996326
10 0.228425159
11 0.212109077
12 0.482672714
13 0.519624663
14 0.553937187
15 0.585798817
16 0.615384615

Much better. To get closer it looks like I need to look at the soft side... Which I guess brings us to MangoJ's spreedsheet.

Looking at MangoJ's spreedsheet, it makes more sense. And I see you are adding the Hard 12 to Hard 16 to get the bust odds, as those are the hands that can bust. I plan on going cell by cell and seeing where it is getting the value from. Then trying to understand why.

As for my program, I already have it tracking how many of each card has been used, and how many of each card is still in the shoe. I am hoping I can start with a formula like in these spreedsheets, then just subtract or add percentages based on the cards left. I would rather not do a full brute force recursion because that will take too much time each hand. There will be too much of a pause.

Hopefully it won't be too hard to calc for a single deck, with one player, and play has ten and 9, and dealer has ten showing, for example. I won't even worry at this point about checks for blackjack and how that effects the odds.

I will keep looking at MangoJ's spreedsheet.

Thanks again, you two have both been very helpful

Keith
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 28th, 2011 at 3:38:29 PM permalink
Quote: MangoJ

You are right. This is generaly what the spreadsheet does. However you will need to distinguish between hard and soft hands. And then things get more complicated, but in essence it is identically to your ansatz.



I had a look at your Excel BJ odds sheet. Nice work! Especially the version with multiple cards.

Quote: MangoJ


Another ansatz would be "forward": draw every possible hand combination into the deck exhaustively and sum up the probabilities of busting. Of course this would be done recursively. Both approaches are equivalent, and yield the same outcome.



Yep. Or just simulating 100 million hands with the game's rules and recording the frequencies. I have progammed some simple Blackjack simulators to analyze some more exotic strategies such as optimizing strategy for Hot Streak side bet (at Microgaming and Wagerworks on-line casinos) and once you have the base routines, changing the program for different rules or # of decks is quite straight-forward.
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 28th, 2011 at 3:47:11 PM permalink
Quote: loveTheOdds

Thanks to both of you two. Very, very helpful.

I redid Jufo's calc and got -

2 0.413258128
3 0.38373969
4 0.356329712
5 0.33087759
6 0.307243476
7 0.285297514
8 0.26491912
9 0.245996326
10 0.228425159
11 0.212109077
12 0.482672714
13 0.519624663
14 0.553937187
15 0.585798817
16 0.615384615

Much better. To get closer it looks like I need to look at the soft side... Which I guess brings us to MangoJ's spreedsheet.



Good job, but please re-check your calculation for P(6). It should be:

P(6) = 1/13*[P(7) + ... + P(15)] + 4/13*P(16) = 0.449255311.

Of course this changes the values P(1) to P(5) as well as they depend on P(6).

Quote: loveTheOdds


Looking at MangoJ's spreedsheet, it makes more sense. And I see you are adding the Hard 12 to Hard 16 to get the bust odds, as those are the hands that can bust. I plan on going cell by cell and seeing where it is getting the value from. Then trying to understand why.

As for my program, I already have it tracking how many of each card has been used, and how many of each card is still in the shoe. I am hoping I can start with a formula like in these spreedsheets, then just subtract or add percentages based on the cards left. I would rather not do a full brute force recursion because that will take too much time each hand. There will be too much of a pause.

Hopefully it won't be too hard to calc for a single deck, with one player, and play has ten and 9, and dealer has ten showing, for example. I won't even worry at this point about checks for blackjack and how that effects the odds.



This should be doable for single-deck and one player. For example if four cards have been drawn from the deck, so that there are 48 left and there are two aces drawn, then instead of using the fixed probability 1/13 to draw an Ace, you would use modified probability of 2/48. So for simple scenarios it shouldn't be too difficult to do it in Excel, but first you need to master the calculations for infinite deck scenario.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 28th, 2011 at 4:57:04 PM permalink
Yes, you are right, my P6 uses 1/13 of the sum of P7 to P16. I was following the pattern given for P7, P8, etc. And obviously not completely understanding it. So for P6, we want four times the value in P16. Not sure why. My best guess is to account for the four ten value cards, 10, jack, queen, king. But why suddenly at P6? I don't see the relationship.

I am guessing P5 is wrong too, as it is just doing the sum/13...

Keith

1 0.459740534
2 0.426901924
3 0.39640893
4 0.368094006
5 0.341801577
6 0.449255311
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 28th, 2011 at 5:38:24 PM permalink
Hm... so for P6 we have P(6) = 1/13*[P(7) + ... + P(15)] + 4/13*P(16) = 0.449255311.

So P5 must be P(5)=1/13*[P(6)+...P(14)]+4/13*P(15)= 0.429648641

And thus -

2 0.37291864
3 0.391315917
4 0.410284406
5 0.429648641
6 0.449255311
7 0.285297514
8 0.26491912
9 0.245996326
10 0.228425159
11 0.212109077
12 0.482672714
13 0.519624663
14 0.553937187
15 0.585798817
16 0.615384615


Although I don't understand why we bump it over and multiply by four. But I did see that both of you are doing it in your calculations.

Keith
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 28th, 2011 at 10:24:39 PM permalink
Quote: loveTheOdds

Hm... so for P6 we have P(6) = 1/13*[P(7) + ... + P(15)] + 4/13*P(16) = 0.449255311.

So P5 must be P(5)=1/13*[P(6)+...P(14)]+4/13*P(15)= 0.429648641

And thus -

2 0.37291864
3 0.391315917
4 0.410284406
5 0.429648641
6 0.449255311
7 0.285297514
8 0.26491912
9 0.245996326
10 0.228425159
11 0.212109077
12 0.482672714
13 0.519624663
14 0.553937187
15 0.585798817
16 0.615384615


Although I don't understand why we bump it over and multiply by four. But I did see that both of you are doing it in your calculations.

Keith



Yes you got the correct values now. You will understand the equation if you consider what is the probability to draw each rank to Six and what is the new point value after that draw.

From a total of six there is obviously a 1/13 chance to draw each of the ranks A-9 which leads to 7 - 15 points, therefore the 1/13 factors for P(7) to P(15) in the equation. (Soft hands haven't been considered yet so 6 + A = 7). There is a 4/13 chance to draw a Ten to Six so there is a 4/13 chance to end up with 16 points, thus the factor of 4/13 for P(16).

Actually for Seven points the equation is similar than with Six points: P(7) = 1/13 * [P(8) + ... + P(16)] + 4/13*P(17)
but since P(17) = 0 (dealer stands on hard 17) the last term in the equation is zero.

I guess this is why you got confused as you forgot the last term, which equals zero on Seven points and above but is non-zero for Six points and less.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 28th, 2011 at 11:11:25 PM permalink
I feel silly. For some reason I wasn't thinking 6 points to get to 16 you need ten points. Now it seems obvious, well now that you pointed it out. Now the formula mods make sense.

But trying to add in softs seems really difficult. For example, for hard 16, we had eight cards that would bust. But for a soft 16 or even soft 17, there are no cards that will bust. The first point that a single card will bust a soft count is at soft 22, which of course can't happen. So going that route seems to hit an immediate road block.

I suppose another route might be to think of the ace as always being 11, and calculating those odds, the join them with the Ace being a 1 odds. But that doesn't seem right either.

I did find Eric Farmer has a program that seems to do this. Maybe I can learn from it. I also am still playing with mangos excel document. But that is a spider web of inter dependencies that are more complicated then your route.

Thanks again,

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 29th, 2011 at 2:20:09 AM permalink
Quote: loveTheOdds

But trying to add in softs seems really difficult. For example, for hard 16, we had eight cards that would bust. But for a soft 16 or even soft 17, there are no cards that will bust. The first point that a single card will bust a soft count is at soft 22, which of course can't happen. So going that route seems to hit an immediate road block.



Softs are not much different than hard hands. All you need to figure out is the right direction of dependency, so you can solve those equations one by one.
This is what you said is the "spider web of inter dependencies", but it's rather simple.

First note that a hand of total 2-10 can never be soft, so they are hard.
Then a hard 11 can never be evolve from a soft hand.
Further, soft 11-21 can never be evolved from a hard 11-21.

So to get the right direction of dependency: First calculate busting probability for Hard 21, Hard 20, ... Hard 12, Hard 11.
Then calculate busting probability from Soft 21, Soft 21, ... Soft 12, Soft 11,
Then calculate busting probability from Hard 10, Hard 9, ... Hard 2.
Then if you like, calculate busting probability for Hard 0. Hard 0 is your hand before drawing any card, and hence gives you the overall busting probability.
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 29th, 2011 at 2:31:03 AM permalink
Quote: loveTheOdds



But trying to add in softs seems really difficult. For example, for hard 16, we had eight cards that would bust. But for a soft 16 or even soft 17, there are no cards that will bust. The first point that a single card will bust a soft count is at soft 22, which of course can't happen. So going that route seems to hit an immediate road block.



Yes, it becomes more complex once you incorporate soft hands. It will get even much more complex once you move from infinite decks to limited decks so I hope you are ready for the challenge :p

To incorporate soft hands, I would add possible soft hand states, namely P(S12), P(S13), ... P(S21). So P(S13) means the probability to bust from Soft 13 while P(13) means the probability to bust from Hard 13 which we calculated already.

For example, the equation for P(S16) becomes:

P(S16) = 1/13*P(S17) + 1/13*P(S18) + 1/13*P(S19) + 1/13*P(S20) + 1/13*P(S21) + 1/13*[P(12) + P(13) + P(14) + P(15)]
+ 4/13 * P(16).

The 4/13 comes again from the fact that drawing a Ten to Soft 16 makes it a Hard 16.

We know the values P(12) ... P(16) from previous calculations and P(S18) ... P(S21) = 0, since dealer cannot bust from Soft 18 to Soft 21. This leaves only the value P(S17) unknown (Hit Soft 17 rule) so it has to be solved first by writing a similar equation for it.

It's not possible to have a soft hand with a total of Hard 11 - 21, so the values P(11) ... P(21) remain unchanged. However the values P(1) ... P(10) need to be updated to include Soft hands. The equation for P(7) is for example:

P(7) = 1/13*P(S18) + 1/13*[P(9) + .... P(16)] + 4/13*P(17)

where P(S18) = 0 and P(17) = 0.

So with this quide you should be able to write equations for all possible values P(1) ... P(10) and P(S12) ... P(S21) using same recursion as before. Let us know if you are able to obtain the correct values or if you need more help. In the end you should end up with results that are similar to MangoJ's Excel sheet.

EDIT: MangoJ replied at the same time.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 29th, 2011 at 3:47:36 AM permalink
Quote: Jufo81


It's not possible to have a soft hand with a total of Hard 11 - 21, so the values P(11) ... P(21) remain unchanged. However the values P(1) ... P(10) need to be updated to include Soft hands.
[...]
Let us know if you are able to obtain the correct values or if you need more help. In the end you should end up with results that are similar to MangoJ's Excel sheet.



You are right with your analysis. And I checked the posted numbers on P(11) to P(16) (well, and P(17) to P(21) of course), they match perfectly with the result of the spreadsheet. When you include the soft hands, I'm 100% sure you will also be able to reproduce P(1) to P(10) and those of the soft hands.

if you already got that, you can then do the whole process again for dealer 21 (instead of bust), 20, ... and every other card. Those should match the spreadsheet numbers as well. See the multi-card spreadsheet if you want to compute a 5-card charlie or similar.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 29th, 2011 at 12:53:15 PM permalink
Quote: MangoJ

Softs are not much different than hard hands. All you need to figure out is the right direction of dependency, so you can solve those equations one by one.
This is what you said is the "spider web of inter dependencies", but it's rather simple.

First note that a hand of total 2-10 can never be soft, so they are hard.
Then a hard 11 can never be evolve from a soft hand.
Further, soft 11-21 can never be evolved from a hard 11-21.



I am going to try to reply to these posts one by one, so they are bite size. Also give me time to digest...

OK, for the above three rules, I agree. I had to think about them, but they make sense.

Quote: MangoJ

So to get the right direction of dependency: First calculate busting probability for Hard 21, Hard 20, ... Hard 12, Hard 11.
Then calculate busting probability from Soft 21, Soft 21, ... Soft 12, Soft 11,
Then calculate busting probability from Hard 10, Hard 9, ... Hard 2.
Then if you like, calculate busting probability for Hard 0. Hard 0 is your hand before drawing any card, and hence gives you the overall busting probability.



Busting for hard 21-hard 17 is zero, since dealer stands. So, hard 16. It could have evolved from a soft total... I think looking at the next post might fill in the blanks.

Keith
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 29th, 2011 at 1:19:19 PM permalink
Quote: Jufo81

Yes, it becomes more complex once you incorporate soft hands. It will get even much more complex once you move from infinite decks to limited decks so I hope you are ready for the challenge :p



Actually once I figure out soft hands, finite decks will be easy. For example, your bust calculations. At hard 16, there are eight cards that will bust, so we did 8/13. But lets say we have one deck, then it hard 16 with undelt deck is (4*8)/52. Or more specifically, ( num of sixes+num of sevens+...num of queens+num of kings)/52. Then lets say we have three cards showing( we will ignore dealer blackjack checks), but four cards dealt. We will not count the hidden because it is just as unknown as the rest of the shoe. So that mean we divide by 52-3=49 instead of dividing by 52.

The other half is to take the cards we have seen, no matter where, and subtract from the formula. For example, if we haven't seen any of the bust cards for Hard 16, then the formula only changes the divide by 49. But lets say one king and a six where dealt, then it becomes (3 sixes+ 4 sevens+... 4 queens+ 3 Kings)/49 or (3+4+4+4+4+4+4+3)/49 = 0.61224

P(6) looked like this = 1/13*(P7+P8+P9+P10+P11+P12+P13+P14+P15)+4/13*P16

So we know P16 are the four tens, count how many are missing from the shoe, P15 is for nines, P14 is for eights, P13 is for sevens, and so on. So for all of your formulas I think I can convert to finite decks.

Let me know if I missed any thing, other then soft hands of course.

Quote: Jufo81

To incorporate soft hands, I would add possible soft hand states, namely P(S12), P(S13), ... P(S21). So P(S13) means the probability to bust from Soft 13 while P(13) means the probability to bust from Hard 13 which we calculated already.

For example, the equation for P(S16) becomes:

P(S16) = 1/13*P(S17) + 1/13*P(S18) + 1/13*P(S19) + 1/13*P(S20) + 1/13*P(S21) + 1/13*[P(12) + P(13) + P(14) + P(15)]
+ 4/13 * P(16).

The 4/13 comes again from the fact that drawing a Ten to Soft 16 makes it a Hard 16.

We know the values P(12) ... P(16) from previous calculations and P(S18) ... P(S21) = 0, since dealer cannot bust from Soft 18 to Soft 21. This leaves only the value P(S17) unknown (Hit Soft 17 rule) so it has to be solved first by writing a similar equation for it.

It's not possible to have a soft hand with a total of Hard 11 - 21, so the values P(11) ... P(21) remain unchanged. However the values P(1) ... P(10) need to be updated to include Soft hands. The equation for P(7) is for example:

P(7) = 1/13*P(S18) + 1/13*[P(9) + .... P(16)] + 4/13*P(17)

where P(S18) = 0 and P(17) = 0.

So with this quide you should be able to write equations for all possible values P(1) ... P(10) and P(S12) ... P(S21) using same recursion as before. Let us know if you are able to obtain the correct values or if you need more help. In the end you should end up with results that are similar to MangoJ's Excel sheet.

EDIT: MangoJ replied at the same time.



OK, if that should be enough for me to get it, let me run some numbers on it. At first glance though I don't see where to start the backwards extrapolation like we did with hard 16 and the eight bust cards. Maybe I just need to look at all the possibilities of a soft 17...
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 29th, 2011 at 1:26:31 PM permalink
Quote: MangoJ


You are right with your analysis. And I checked the posted numbers on P(11) to P(16) (well, and P(17) to P(21) of course), they match perfectly with the result of the spreadsheet. When you include the soft hands, I'm 100% sure you will also be able to reproduce P(1) to P(10) and those of the soft hands.

if you already got that, you can then do the whole process again for dealer 21 (instead of bust), 20, ... and every other card. Those should match the spreadsheet numbers as well. See the multi-card spreadsheet if you want to compute a 5-card charlie or similar.



Thanks for confirming that. I keep looking at your spreedsheet. I understand 90% of it now, including most of the actual cards that each number represents. Which means I am close to applying it to a finite deck as mentioned above. With some more thought and number crunching, I may figure out the last 10%.

Thanks so much to both of you two. I feel I have learned a lot from all of this.

Keith
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 29th, 2011 at 1:42:39 PM permalink
Quote: loveTheOdds


The other half is to take the cards we have seen, no matter where, and subtract from the formula. For example, if we haven't seen any of the bust cards for Hard 16, then the formula only changes the divide by 49. But lets say one king and a six where dealt, then it becomes (3 sixes+ 4 sevens+... 4 queens+ 3 Kings)/49 or (3+4+4+4+4+4+4+3)/49 = 0.61224

P(6) looked like this = 1/13*(P7+P8+P9+P10+P11+P12+P13+P14+P15)+4/13*P16

So we know P16 are the four tens, count how many are missing from the shoe, P15 is for nines, P14 is for eights, P13 is for sevens, and so on. So for all of your formulas I think I can convert to finite decks.

Let me know if I missed any thing, other then soft hands of course.



Yes, that's how you can calculate the odds for finite decks. But it gets a bit complicated because for example, for P6 you need to calculate P7 ... P16 like in the equation above and all of these equations for P7 ... P16 need to adjusted depending on how many cards of each rank have been removed from the deck, which includes removing the specific card from the deck that gives you that particular total.

Quote: loveTheOdds


OK, if that should be enough for me to get it, let me run some numbers on it. At first glance though I don't see where to start the backwards extrapolation like we did with hard 16 and the eight bust cards. Maybe I just need to look at all the possibilities of a soft 17...



You should start by making equation for Soft 17, that is P(S17). You can use the equation for P(S16) I wrote as an example. Then solve the equations backwards: P(S16), P(S15) and so on until P(S12). After you get numerical values for these, solve P(10), P(9), ..., P(1) in this order backwards.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 29th, 2011 at 2:09:11 PM permalink
So, soft 18-21 is zero, so skipping those

P(S17)=1/13*[P(12)+P(13)+P(14)+P(15)+P(16)]+4/13*P(17)

of course P(S17)=P(S17)=1/13*[P(12)+P(13)+P(14)+P(15)+P(16)]

And I think I understand Mangos excel doc enough to apply it to a finite deck. I will see if I can write a simple C# program as a proof of concept. Although the formulas are recursive, one pass should do it if the formulas are in the right order.

You guys are awesome.

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 29th, 2011 at 2:15:22 PM permalink
Quote: loveTheOdds

Which means I am close to applying it to a finite deck as mentioned above.



Good luck with that. Honestly I never understood much of compositional hands other than the simple "brute force" approach. I would be delighted if you could teach me.
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 29th, 2011 at 2:42:13 PM permalink
Quote: loveTheOdds

So, soft 18-21 is zero, so skipping those

P(S17)=1/13*[P(12)+P(13)+P(14)+P(15)+P(16)]+4/13*P(17)

of course P(S17)=P(S17)=1/13*[P(12)+P(13)+P(14)+P(15)+P(16)]



Yes, and once you get the value for P(S17), use it to solve P(S16) on so on in backwards order.

Quote: loveTheOdds


And I think I understand Mangos excel doc enough to apply it to a finite deck. I will see if I can write a simple C# program as a proof of concept. Although the formulas are recursive, one pass should do it if the formulas are in the right order.

You guys are awesome.

Keith



Using recursion in progamming languages is often efficient way to solve the problem. I am also curious to see your results.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 29th, 2011 at 10:14:56 PM permalink
OK, here is what I have. I tried to write it so even a non-programmer can follow it. Because of that the code is rather clunky.

As is it is set up to ignore visible cards. As thus I can verify the results match Mangos spreadsheet. Change the false to true, to add in the dealers top card, or actually to remove it from the shoe as it is. Add some values to the one array, 1-10, to see what dealt or previously dealt cards do to the odds. Now, the question is, how can I verify some card combos to what the dealers bust should be? I.e. how can I verify the visible cards part works?

Keith

---------


using System;

namespace BJDealerBust
{
class Program
{
public static void Main(string[] args)
{
//This is a proof of concept and is written so that non-programmers can follow it.
//Thus limited array usage. limited for or foreach's, simple decisions, etc.
double h2=0,h3=0,h4=0,h5=0,h6=0,h7=0,h8=0,h9=0,h10=0,h11=0,h12=0,h13=0,h14=0,h15=0,h16=0;
double s11=0,s12=0,s13=0,s14=0,s15=0,s16=0;
double bust=0;
int dealersTopCard=10;
int numOfDecks=1;
//The below would be much easier to program as an array, but hopefully easier to read this way.
int numAcesLeft=numOfDecks*4,numTwosLeft=numOfDecks*4,numThreesLeft=numOfDecks*4;
int numFoursLeft=numOfDecks*4,numFivesLeft=numOfDecks*4,numSixesLeft=numOfDecks*4;
int numSevensLeft=numOfDecks*4,numEightsLeft=numOfDecks*4,numNinesLeft=numOfDecks*4;
int numTensLeft=numOfDecks*4*4; //Tens account for 10, J, Q, K

int[] cardsDealt=new int[] { 0,0,0,0,0}; //Yes, this is an array holding each value in {}
//values above should be the card value, 1 for aces, 2 for twos,... 10 for 10's, Jacks, Queens, Kings
//Also you can add more numbers above, this was to show formatting.

//This will go through each value in our array and return it as "card"
foreach (int card in cardsDealt)
{
if (card==1) {numAcesLeft=numAcesLeft-1;}
if (card==2) {numTwosLeft=numTwosLeft-1;}
if (card==3) {numThreesLeft=numThreesLeft-1;}
if (card==4) {numFoursLeft=numFoursLeft-1;}
if (card==5) {numFivesLeft=numFivesLeft-1;}
if (card==6) {numSixesLeft=numSixesLeft-1;}
if (card==7) {numSevensLeft=numSevensLeft-1;}
if (card==8) {numEightsLeft=numEightsLeft-1;}
if (card==9) {numNinesLeft=numNinesLeft-1;}
if (card==10) {numTensLeft=numTensLeft-1;}
//notice there is no zero, or >10 as those will be ignored
}
//Change to false to duplicate Mangos spreedsheet
if (false)
{
if (dealersTopCard==1) {numAcesLeft=numAcesLeft-1;}
if (dealersTopCard==2) {numTwosLeft=numTwosLeft-1;}
if (dealersTopCard==3) {numThreesLeft=numThreesLeft-1;}
if (dealersTopCard==4) {numFoursLeft=numFoursLeft-1;}
if (dealersTopCard==5) {numFivesLeft=numFivesLeft-1;}
if (dealersTopCard==6) {numSixesLeft=numSixesLeft-1;}
if (dealersTopCard==7) {numSevensLeft=numSevensLeft-1;}
if (dealersTopCard==8) {numEightsLeft=numEightsLeft-1;}
if (dealersTopCard==9) {numNinesLeft=numNinesLeft-1;}
if (dealersTopCard==10) {numTensLeft=numTensLeft-1;}
}



int numOfCardsLeft=numAcesLeft+numTwosLeft+numThreesLeft+numFoursLeft+numFivesLeft+numSixesLeft+numSevensLeft+numEightsLeft+numNinesLeft+numTensLeft;
Console.WriteLine("Number of cards left= "+numOfCardsLeft);

//That is all the setup we need. Now we can do Mangos spreadsheet formulas
//We just modify the formula to handle number of cards left
//Also we need to look for the dealersTopCard, to set that to 1.

s11=0;
if (dealersTopCard==1) {s11=1;}
s12=numAcesLeft*s11/numOfCardsLeft;
h2=0;
if (dealersTopCard==2) {h2=1;}
s13=(numTwosLeft*s11+numAcesLeft*s12+numAcesLeft*h2)/numOfCardsLeft;
h3=0;
if (dealersTopCard==3) {h3=1;}
s14=(numThreesLeft*s11+numTwosLeft*s12+numAcesLeft*s13+numAcesLeft*h3)/numOfCardsLeft;
h4=(numTwosLeft*h2)/numOfCardsLeft;
if (dealersTopCard==4) {h4=1;}
s15=(numFoursLeft*s11+ numThreesLeft*s12+numTwosLeft*s13+numAcesLeft*s14+numAcesLeft*h4)/numOfCardsLeft;
h5=(numTwosLeft*h3+numThreesLeft*h2)/numOfCardsLeft;
if (dealersTopCard==5) {h5=1;}
s16=(numFivesLeft*s11+numFoursLeft*s12+ numThreesLeft*s13+numTwosLeft*s14+numAcesLeft*s15+numAcesLeft*h5)/numOfCardsLeft;
h6=(numTwosLeft*h4+numThreesLeft*h3+numFoursLeft*h2)/numOfCardsLeft;
if (dealersTopCard==6) {h6=1;}
h7=(numTwosLeft*h5+numThreesLeft*h4+numFoursLeft*h3+numFivesLeft*h2)/numOfCardsLeft;
if (dealersTopCard==7) {h7=1;}
h8=(numTwosLeft*h6+numThreesLeft*h5+numFoursLeft*h4+numFivesLeft*h3+numSixesLeft*h2)/numOfCardsLeft;
if (dealersTopCard==8) {h8=1;}
h9=(numTwosLeft*h7+numThreesLeft*h6+numFoursLeft*h5+numFivesLeft*h4+numSixesLeft*h3+numSevensLeft*h2)/numOfCardsLeft;
if (dealersTopCard==9) {h9=1;}
h10=(numTwosLeft*h8+numThreesLeft*h7+numFoursLeft*h6+numFivesLeft*h5+numSixesLeft*h4+numSevensLeft*h3+numEightsLeft*h2)/numOfCardsLeft;
if (dealersTopCard==10) {h10=1;}
h11=(numTwosLeft*h9+numThreesLeft*h8+numFoursLeft*h7+numFivesLeft*h6+numSixesLeft*h5+
numSevensLeft*h4+numEightsLeft*h3+numNinesLeft*h2)/numOfCardsLeft;
//note that below we don't do 4* tens since we already did that above, in the num left calc.
h12=(numTwosLeft*h10+numThreesLeft*h9+numFoursLeft*h8+numFivesLeft*h7+numSixesLeft*h6+
numSevensLeft*h5+numEightsLeft*h4+numNinesLeft*h3+numTensLeft*h2+numAcesLeft*h11+
numSixesLeft*s16+numSevensLeft*s15+numEightsLeft*s14+numNinesLeft*s13+numTensLeft*s12)/numOfCardsLeft;
h13=(numTwosLeft*h11+numThreesLeft*h10+numFoursLeft*h9+numFivesLeft*h8+numSixesLeft*h7+
numSevensLeft*h6+numEightsLeft*h5+numNinesLeft*h4+numTensLeft*h3+numAcesLeft*h12+
+numSevensLeft*s16+numEightsLeft*s15+numNinesLeft*s14+numTensLeft*s13)/numOfCardsLeft;
h14=(numTwosLeft*h12+numThreesLeft*h11+numFoursLeft*h10+numFivesLeft*h9+numSixesLeft*h8+
numSevensLeft*h7+numEightsLeft*h6+numNinesLeft*h5+numTensLeft*h4+numAcesLeft*h13+
+numEightsLeft*s16+numNinesLeft*s15+numTensLeft*s14)/numOfCardsLeft;
h15=(numTwosLeft*h13+numThreesLeft*h12+numFoursLeft*h11+numFivesLeft*h10+numSixesLeft*h9+
numSevensLeft*h8+numEightsLeft*h7+numNinesLeft*h6+numTensLeft*h5+numAcesLeft*h14+
+numNinesLeft*s16+numTensLeft*s15)/numOfCardsLeft;
h16=(numTwosLeft*h14+numThreesLeft*h13+numFoursLeft*h12+numFivesLeft*h11+numSixesLeft*h10+
numSevensLeft*h9+numEightsLeft*h8+numNinesLeft*h7+numTensLeft*h6+numAcesLeft*h15+
+numTensLeft*s16)/numOfCardsLeft;

bust=((numSixesLeft+numSevensLeft+numEightsLeft+numNinesLeft+numTensLeft)*h16+
(numSevensLeft+numEightsLeft+numNinesLeft+numTensLeft)*h15+
(numEightsLeft+numNinesLeft+numTensLeft)*h14+
(numNinesLeft+numTensLeft)*h13+
numTensLeft*h12)/numOfCardsLeft;

Console.WriteLine(numSixesLeft+"\n"+
(numSevensLeft)+"\n"+
(numEightsLeft)+"\n"+
(numNinesLeft)+"\n"+
numTensLeft);
Console.WriteLine("Dealer bust win with top card of "+dealersTopCard+" is "+bust*100);


Console.WriteLine("h2= "+h2+"\n"+
"h3= "+h3+"\n"+
"h4= "+h4+"\n"+
"h5= "+h5+"\n"+
"h6= "+h6+"\n"+
"h7= "+h7+"\n"+
"h8= "+h8+"\n"+
"h9= "+h9+"\n"+
"h10= "+h10+"\n"+
"h11= "+h11+"\n"+
"h12= "+h12+"\n"+
"h13= "+h13+"\n"+
"h14= "+h14+"\n"+
"h15= "+h15+"\n"+
"h16= "+h16+"\n"+
"s11= "+s11+"\n"+
"s12= "+s12+"\n"+
"s13= "+s13+"\n"+
"s14= "+s14+"\n"+
"s15= "+s15+"\n"+
"s16= "+s16);



Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 29th, 2011 at 10:28:10 PM permalink
Just as remark, you should use arrays - then it will be a lot more readable.

For compositional hand bust values: I once wrote a program that follows the brute force concept. I will post it here as well.


#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <time.h>

#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))

#define DEALER_BUST 0
#define DEALER_STAND17 1
#define DEALER_STAND18 2
#define DEALER_STAND19 3
#define DEALER_STAND20 4
#define DEALER_STAND21 5
#define DEALER_BLACKJACK 6
#define DEALER_RESERVED 7

typedef struct {
float p[8]; // probability results for indexes DEALER_*
} DealerResults;

typedef struct {
char cards[10];
char total;
} Deck;

typedef struct {
char value; // playing value (1-31)
char soft; // 1=soft hand, 0=hard hand
char cards; // number of cards of this hand
} Hand;

const char cardName[10] = {'A','2','3','4','5','6','7','8','9','T'};
const char cardValue[10] = {11, 2, 3, 4, 5, 6, 7, 8, 9, 10};
const char cardSoft[10] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};


DealerResults DealerStrategy(Hand Dealer, Deck Remaining) {
// printf("DealerStrategy(Deck=%u,%u,%u,%u,%u,%u,%u,%u,%u,%u\tDeckCount=%u)\n", Remaining[0], Remaining[1], Remaining[2], Remaining[3], Remaining[4], Remaining[5], Remaining[6], Remaining[7], Remaining[8], Remaining[9], DeckCount);
DealerResults ret = {{0,0,0,0,0,0,0,0}};
DealerResults r;

// Dealer stands on all 17, Dealer does not peek for Blackjack
if(Dealer.value < 17) {

for(int k=0; k<10; k++) {
if (Remaining.cards[k] > 0) { // having chance of drawing ? (avoids crawling zero-contribution treebranches
float chance = (float)(Remaining.cards[k]) / Remaining.total; // chance of hitting in the remaining deck
if((Dealer.value + cardValue[k] >= 22) && (Dealer.soft + cardSoft[k] >= 1)) {
Dealer.value += cardValue[k] - 10;
Dealer.soft += cardSoft[k] - 1;
Dealer.cards++;
Remaining.cards[k]--;
Remaining.total--;
r = DealerStrategy(Dealer, Remaining);
for(int n=0; n<8; n++) {
ret.p[n] += chance*r.p[n];
}
Dealer.value -= cardValue[k] - 10;
Dealer.soft -= cardSoft[k] - 1;
Dealer.cards--;
Remaining.cards[k]++;
Remaining.total++;
} else {
Dealer.value += cardValue[k];
Dealer.soft += cardSoft[k];
Dealer.cards++;
Remaining.cards[k]--;
Remaining.total--;
r = DealerStrategy(Dealer, Remaining);
for(int n=0; n<8; n++) {
ret.p[n] += chance*r.p[n];
}
Dealer.value -= cardValue[k];
Dealer.soft -= cardSoft[k];
Dealer.cards--;
Remaining.cards[k]++;
Remaining.total++;
}
}
}
} else {
// Dealer Result table
if (Dealer.value >= 22) {
ret.p[DEALER_BUST] = 1.f; // Dealer busts
} else if(Dealer.value == 17) {
ret.p[DEALER_STAND17] = 1.f; // Dealer stands 17
} else if(Dealer.value == 18) {
ret.p[DEALER_STAND18] = 1.f; // Dealer stands 18
} else if(Dealer.value == 19) {
ret.p[DEALER_STAND19] = 1.f; // Dealer stands 19
} else if(Dealer.value == 20) {
ret.p[DEALER_STAND20] = 1.f; // Dealer stands 20
} else if(Dealer.value == 21 && Dealer.cards > 2) {
ret.p[DEALER_STAND21] = 1.f; // Dealer stands 21
} else if(Dealer.value == 21 && Dealer.cards == 2) {
ret.p[DEALER_BLACKJACK] = 1.f; // Dealer has Blackjack
} else {
printf("Dealer.value=%u\tsoft=%u\tcards=%u\n", Dealer.value, Dealer.soft, Dealer.cards);
assert(0);
}
}

return ret;
}


This is a snippet of my full combinatorial program (unpublished). You can check your results against it.
Usage for the dealer part is simple: Just call DealerStrategy(Hand Dealer, Deck Remaining) with Dealers Hand struct and remaining Deck struct.
For accurate results, the dealers upcard must not be present in the remaining Deck.

I hope this snippet is complete (didn't test it). If it wont compile, please let me know.

Edit: I just see you are interested in a "Dealer hit soft 17" game. The code is for a "Dealer stand all 17". Modification for a H17 game is easy:

Replace the line
if(Dealer.value < 17) {
with
if(Dealer.value - Dealer.soft < 17) {

Edit^2: The forum software has problems displaying code segments properly. I hope you can copy&paste it. If in doubt, enter "quote" mode and extract the code from there.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 29th, 2011 at 10:28:18 PM permalink
Towards the top you set the dealers card to a value, ace=1... to 10 for ten, jack, queen, king. right now it is set for ten.

Also towards the bottom I left in some debugging output lines that shows num cards left for various numbers. This should be deleted.

I tried Eric Farmers BJ program. For vegas strip, with dealer having 4, player jack and 6, he gets a bust of 39.5778, mine gets 40.4279

The spreadsheet for 4, shows 39.447. Almost as if Eric isn't looking at remaining cards in the shoe. Or maybe the vegas strip is not the right choice. I am super new to Erics program. Is there an online one that can be used for checking that looks at finite decks with cards removed...?

Thanks,

Keith
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
April 30th, 2011 at 12:14:42 AM permalink
Did you manage to get the bust odds for all dealer upcards including Soft hands? According to MangoJ's Excel calc with infinite decks and Hit Soft 17 the final bust probabilities should be:

Upcard Ace - P(1) = 0.13892
Upcard Two - P(2) = 0.35673
Upcard Three - P(3) =0.37668
Upcard Four - P(4) = 0.39708
Upcard Five -P(5) = 0.41766
Upcard Six - P(6) = 0.43947
Upcard Seven - P(7) = 0.26231
Upcard Eight - P(8) = 0.24474
Upcard Nine - P(9) = 0.22843
Upcard Ten - P(10) = 0.21211

The Bust probabilities for total of 11-16 remain unchanged as these don't include soft hands.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 30th, 2011 at 2:16:37 AM permalink
Okay, I give you a few numbers to check your results against. These are the Bust probabilities against the Dealer (only) upcard. Finite deck probabilities are calculated with my posted C program. Infinite deck is from the spreadsheet. First block is on a Stand-17 game, second is on a Hit-17 game.


Dealer stands on all 17 (no peek for Blackjack)
1D: A: 0.116540 2: 0.352973 3: 0.375588 4: 0.402803 5: 0.428905 6: 0.420823 7: 0.259854 8: 0.238627 9: 0.233442 T: 0.214264
2D: A: 0.115872 2: 0.353291 3: 0.374794 4: 0.398540 5: 0.422505 6: 0.422132 7: 0.261143 8: 0.241630 9: 0.230898 T: 0.213191
4D: A: 0.115569 2: 0.353451 3: 0.374349 4: 0.396481 5: 0.419419 6: 0.422676 7: 0.261742 8: 0.243173 9: 0.229653 T: 0.212651
8D: A: 0.115426 2: 0.353530 3: 0.374115 4: 0.395469 5: 0.417902 6: 0.422922 7: 0.262031 8: 0.243954 9: 0.229037 T: 0.212381
16D: A: 0.115355 2: 0.353569 3: 0.373996 4: 0.394967 5: 0.417151 6: 0.423038 7: 0.262173 8: 0.244347 9: 0.228731 T: 0.212245
32D: A: 0.115321 2: 0.353589 3: 0.373936 4: 0.394718 5: 0.416777 6: 0.423095 7: 0.262243 8: 0.244544 9: 0.228578 T: 0.212177
64D: A: 0.115303 2: 0.353598 3: 0.373905 4: 0.394593 5: 0.416590 6: 0.423123 7: 0.262278 8: 0.244642 9: 0.228501 T: 0.212143
128D: A: 0.115295 2: 0.353603 3: 0.373890 4: 0.394531 5: 0.416497 6: 0.423137 7: 0.262295 8: 0.244692 9: 0.228463 T: 0.212126
256D: A: 0.115291 2: 0.353606 3: 0.373883 4: 0.394500 5: 0.416450 6: 0.423144 7: 0.262304 8: 0.244717 9: 0.228444 T: 0.212118
512D: A: 0.115288 2: 0.353607 3: 0.373879 4: 0.394484 5: 0.416427 6: 0.423147 7: 0.262308 8: 0.244729 9: 0.228435 T: 0.212113
1024D: A: 0.115287 2: 0.353608 3: 0.373877 4: 0.394476 5: 0.416415 6: 0.423149 7: 0.262310 8: 0.244735 9: 0.228430 T: 0.212111
InfD: A: 0,115286 2: 0,353608 3: 0,373875 4: 0,394468 5: 0,416404 6: 0,423150 7: 0,262312 8: 0,244741 9: 0,228425 T: 0,212109



Dealer hits soft 17 (no peek for Blackjack)
1D: A: 0.140394 2: 0.356345 3: 0.378075 4: 0.405796 5: 0.429961 6: 0.437756 7: 0.259854 8: 0.238627 9: 0.233442 T: 0.214264
2D: A: 0.139626 2: 0.356527 3: 0.377460 4: 0.401328 5: 0.423668 6: 0.438754 7: 0.261143 8: 0.241630 9: 0.230898 T: 0.213191
4D: A: 0.139266 2: 0.356627 3: 0.377090 4: 0.399176 5: 0.420629 6: 0.439144 7: 0.261742 8: 0.243173 9: 0.229653 T: 0.212651
8D: A: 0.139091 2: 0.356677 3: 0.376891 4: 0.398119 5: 0.419136 6: 0.439314 7: 0.262031 8: 0.243954 9: 0.229037 T: 0.212381
16D: A: 0.139005 2: 0.356703 3: 0.376788 4: 0.397596 5: 0.418395 6: 0.439392 7: 0.262173 8: 0.244347 9: 0.228731 T: 0.212245
32D: A: 0.138963 2: 0.356715 3: 0.376735 4: 0.397335 5: 0.418026 6: 0.439430 7: 0.262243 8: 0.244544 9: 0.228578 T: 0.212177
64D: A: 0.138942 2: 0.356722 3: 0.376709 4: 0.397205 5: 0.417842 6: 0.439448 7: 0.262278 8: 0.244642 9: 0.228501 T: 0.212143
128D: A: 0.138931 2: 0.356725 3: 0.376695 4: 0.397140 5: 0.417751 6: 0.439457 7: 0.262295 8: 0.244692 9: 0.228463 T: 0.212126
256D: A: 0.138926 2: 0.356726 3: 0.376689 4: 0.397108 5: 0.417705 6: 0.439462 7: 0.262304 8: 0.244717 9: 0.228444 T: 0.212118
512D: A: 0.138923 2: 0.356727 3: 0.376685 4: 0.397091 5: 0.417682 6: 0.439464 7: 0.262308 8: 0.244729 9: 0.228435 T: 0.212113
1024D: A: 0.138922 2: 0.356727 3: 0.376684 4: 0.397083 5: 0.417670 6: 0.439465 7: 0.262310 8: 0.244735 9: 0.228430 T: 0.212111
InfD: A: 0,138920 2: 0,356728 3: 0,376682 4: 0,397075 5: 0,417659 6: 0,439467 7: 0,262312 8: 0,244741 9: 0,228425 T: 0,212109



Interestingly it seems the dealers busts more often when he hits soft 17.

Edit: Numbers seem acurate, as the infinite Deck neatless blend in, and the finite deck (for 1-8 decks) are the same as published on WoO https://wizardofodds.com/blackjack/appendix2b.html
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 30th, 2011 at 11:44:39 AM permalink
Quote: Jufo81

Did you manage to get the bust odds for all dealer upcards including Soft hands? According to MangoJ's Excel calc with infinite decks and Hit Soft 17 the final bust probabilities should be:

Upcard Ace - P(1) = 0.13892
Upcard Two - P(2) = 0.35673
Upcard Three - P(3) =0.37668
Upcard Four - P(4) = 0.39708
Upcard Five -P(5) = 0.41766
Upcard Six - P(6) = 0.43947
Upcard Seven - P(7) = 0.26231
Upcard Eight - P(8) = 0.24474
Upcard Nine - P(9) = 0.22843
Upcard Ten - P(10) = 0.21211

The Bust probabilities for total of 11-16 remain unchanged as these don't include soft hands.




The program, if set with no visible cards, and the block is left false, i.e. it doesn't subtract any cards, then I get this.

Dealer bust win with top card of 1 is 11.5286270301169
Dealer bust win with top card of 2 is 35.3608136395361
Dealer bust win with top card of 3 is 37.3874885382143
Dealer bust win with top card of 4 is 39.4468445502543
Dealer bust win with top card of 5 is 41.6403669582262
Dealer bust win with top card of 6 is 42.3150492084998
Dealer bust win with top card of 7 is 26.2312408361533
Dealer bust win with top card of 8 is 24.4741242251191
Dealer bust win with top card of 9 is 22.8425159434445
Dealer bust win with top card of 10 is 21.2109076617699

That is what I get with Mangos spreadsheet. For Ace I put a 1 in soft 11. How did you get .13892?

Where you able to follow the program, or do you think I should have used arrays and other things to make it look like a normal program?
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 30th, 2011 at 12:01:36 PM permalink
Quote: MangoJ

Just as remark, you should use arrays - then it will be a lot more readable.

For compositional hand bust values: I once wrote a program that follows the brute force concept. I will post it here as well.


This is a snippet of my full combinatorial program (unpublished). You can check your results against it. ...

partial quote

I didn't know you are a programmer. I can imagine it is not what you are used to reading... It was actually hard to write it that way... oh well.

Your snippit looks complete. I didn't see any undeclared variables or structs. How long does it take to run? And from your other post this gives you the same as https://wizardofodds.com/blackjack/appendix2b.html . There should be a small difference though since you are doing infinite decks. I need to look at your post numbers again to compare. But the big question is why the excel doc isn't closer to apendix2b.

Keith
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 30th, 2011 at 12:11:20 PM permalink
Quote: Jufo81

Did you manage to get the bust odds for all dealer upcards including Soft hands? According to MangoJ's Excel calc with infinite decks and Hit Soft 17 the final bust probabilities should be:

Upcard Ace - P(1) = 0.13892
Upcard Two - P(2) = 0.35673
Upcard Three - P(3) =0.37668
Upcard Four - P(4) = 0.39708
Upcard Five -P(5) = 0.41766
Upcard Six - P(6) = 0.43947
Upcard Seven - P(7) = 0.26231
Upcard Eight - P(8) = 0.24474
Upcard Nine - P(9) = 0.22843
Upcard Ten - P(10) = 0.21211

The Bust probabilities for total of 11-16 remain unchanged as these don't include soft hands.



BTW, if I deduct the dealers top card from remaining possibilities, I get :

Dealer bust with top card of 1 is 11.3711105464417
Dealer bust with top card of 2 is 35.43022620265
Dealer bust with top card of 3 is 37.5219133847006
Dealer bust with top card of 4 is 40.399916676268
Dealer bust with top card of 5 is 42.7909756650735
Dealer bust with top card of 6 is 42.2541979527978
Dealer bust with top card of 7 is 25.7737080406463
Dealer bust with top card of 8 is 23.7356931171223
Dealer bust with top card of 9 is 23.0586830564052
Dealer bust with top card of 10 is 21.2279009200322
Press any key to continue . . .
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
April 30th, 2011 at 12:17:52 PM permalink
Quote: loveTheOdds

partial quote

I didn't know you are a programmer. I can imagine it is not what you are used to reading... It was actually hard to write it that way... oh well.

Your snippit looks complete. I didn't see any undeclared variables or structs. How long does it take to run? And from your other post this gives you the same as https://wizardofodds.com/blackjack/appendix2b.html . There should be a small difference though since you are doing infinite decks. I need to look at your post numbers again to compare. But the big question is why the excel doc isn't closer to apendix2b.

Keith



My mistake, I see you are passing the remaining deck on each recursive pass. Still wonder how long it takes with say, one deck, 6 decks, 12 decks. So with my changes to the excel doc, that I put into the program, I wonder why the small difference. Did the excel doc stand or hit on soft 17? I will have to look later.

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 30th, 2011 at 12:51:27 PM permalink
Quote: loveTheOdds


Your snippit looks complete. I didn't see any undeclared variables or structs. How long does it take to run? And from your other post this gives you the same as https://wizardofodds.com/blackjack/appendix2b.html . There should be a small difference though since you are doing infinite decks. I need to look at your post numbers again to compare. But the big question is why the excel doc isn't closer to apendix2b.



I used that routine on a larger problem, and as far as I know on my crappy netbook it took ~ 20ms to run. You would need a small wrapper which calls the routine and prints the result, though (didn't provide that). I'm sure one can optimize that (I didn't try, as I had useed a cache anyway).

As far as the small differences in numbers: The spreadsheet is strictly for an infinite deck. WizardOfOdds values are for finite decks.
The C program is able to compute those finite decks. In post69662 (last on page 3) I've posted a table showing the data for finite-size decks (single deck up ridiculous 1024 decks) as well as the infinite deck result from the spreadsheet.
You can there see from the numbers, comparing each line with the next (for each column of dealers upcard), that the finite deck results (the first 8 decks also in the appendix2b of WoO) evolve with increasing deck size into the infinite deck results (from the excel file). This evolution is seamless as should be expected - 1024 decks should be quite close to an infinite deck....

Hence the small difference is purely a finite size effect of the deck. Depending on your bigger problem you want to solve, the infinite approximation might (or might not) be an acceptable approximation - given that the infinite deck is a lot easier and faster to calculate.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
April 30th, 2011 at 1:10:32 PM permalink
Quote: loveTheOdds

My mistake, I see you are passing the remaining deck on each recursive pass. Still wonder how long it takes with say, one deck, 6 decks, 12 decks. So with my changes to the excel doc, that I put into the program, I wonder why the small difference. Did the excel doc stand or hit on soft 17? I will have to look later.



The routine takes about 0.02s for completion, and that is almost independent of decksize - as cards are recursively drawn until dealer busts or stands.
I'm not an expert in programming, yes the routine is recursive and I guess the remaining deck data will pile up on the stack. Might be faster if using a call by reference argument. (Actually I didn't care about performance when I wrote it).

The code and the excel file are both for stand on soft 17 (S17).
The code can easily be changed to a hit soft 17 dealer, replace the single line "if(Dealer.value < 17)" with "if(Dealer.value - Dealer.soft < 17)".
I did not check this, but you could also do a infinite calculation with the code, just remove all manipulations of the "Remaining" deck in the recursive routine.

The routine has to be called with the remaining deck distribution, and the dealers hand. For proper results, the dealer cards must be removed from the remaining deck.
So on a single Deck game, the remaining deck should represent 51 cards (the original 52 cards with the upcard missing). The advantage of that approach is, that you can also compute dealer probabilities against any number of players with their player hands known. Just remove the known player cards from the remaining deck when calling.


Here is a wrapper, to make a full program


unsigned int PickCard(unsigned int C, Hand* H, Deck* D) {
if(D) {
D->cards[C ]--;
D->total--;
}
if(H) {
H->value += cardValue[C ];
H->soft += cardSoft[C ];
H->cards++;
while(H->value >= 22 && H->soft >= 1) {
H->value -= 10;
H->soft--;
}
}
return C;
}

void main() {
for(int N = 1; N<=1024; N*=2) {
printf("%uD: ", N);
for(int DCard = 0; DCard < 10; DCard++) {
Deck CurrentDeck = {{N*4,N*4,N*4,N*4,N*4,N*4,N*4,N*4,N*4,N*16},N*52};
Hand Dealer = {0,0,0};
PickCard(DCard, &Dealer, &CurrentDeck);
DealerResults r = DealerStrategy(Dealer, CurrentDeck);
printf("%c: %f\t", cardName[DCard], r.p[DEALER_BUST]);
}
printf("\n");
}
}
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
May 1st, 2011 at 12:51:29 AM permalink
Quote: loveTheOdds

The program, if set with no visible cards, and the block is left false, i.e. it doesn't subtract any cards, then I get this.

Dealer bust win with top card of 1 is 11.5286270301169
Dealer bust win with top card of 2 is 35.3608136395361
Dealer bust win with top card of 3 is 37.3874885382143
Dealer bust win with top card of 4 is 39.4468445502543
Dealer bust win with top card of 5 is 41.6403669582262
Dealer bust win with top card of 6 is 42.3150492084998
Dealer bust win with top card of 7 is 26.2312408361533
Dealer bust win with top card of 8 is 24.4741242251191
Dealer bust win with top card of 9 is 22.8425159434445
Dealer bust win with top card of 10 is 21.2109076617699

That is what I get with Mangos spreadsheet. For Ace I put a 1 in soft 11. How did you get .13892?



The values I posted are for Hit Soft 17 which was the rule you originally talked about. Hitting soft 17 increases Ace upcard bust rate by 11.53% -> 13.89%. The above values seem to refer to Stand soft 17. Mango's spreadsheet gives the bust values for Stand soft 17 but by modifying the spreadsheet a bit, you'll get Hit soft 17 bust values from it, too. I asked what values you got to make sure your program gets them right for infinite decks before you move to finite decks.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 1st, 2011 at 10:41:16 AM permalink
Quote: Jufo81

The values I posted are for Hit Soft 17 which was the rule you originally talked about. Hitting soft 17 increases Ace upcard bust rate by 11.53% -> 13.89%. The above values seem to refer to Stand soft 17. Mango's spreadsheet gives the bust values for Stand soft 17 but by modifying the spreadsheet a bit, you'll get Hit soft 17 bust values from it, too. I asked what values you got to make sure your program gets them right for infinite decks before you move to finite decks.



Yes, you are correct. The first thing I did was verify they matched the spreadsheet. Which they did. I forgot Mango was doing Stand soft 17.

I do need to modify it then. Maybe modify the spreadsheet as well, so I can verify the two of them.

As for Stand soft 17, the numbers with the top card calculated in, come pretty close to the Wizards table 2b for stand soft 17. So close that I wonder what is being missed or maybe I did a typo in my program.

I came down with a cold and spent yesterday sleeping and resting. Better today but still not 100%. So sorry for the delay.

Keith
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 1st, 2011 at 11:15:45 AM permalink
Quote: MangoJ



Here is a wrapper, to make a full program



I tried cut and paste of the two code blocks you posted. I dropped them into Visual Studio. The compiler showed numerous errors. Of course these could be compounded, so maybe only a few errors...

First error was on unsigned as the parameter to the PickCard method, Error expected identifier. Hand* threw a error, this declaration has not storage class or type specifier.

etc.

Could just be a syntax issue some place. I don't see anything missing from the cut and paste operation itself. My comfort level is much higher with C#, so I may just convert it to C# and work with it there.

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
May 1st, 2011 at 12:26:22 PM permalink
Quote: loveTheOdds


First error was on unsigned as the parameter to the PickCard method, Error expected identifier. Hand* threw a error, this declaration has not storage class or type specifier.



Sorry Keith, I have no knowledge of Visual Studio. It compiles with GCC though.
Maybe you need a file extension .c for Visual Studio to identify it as a C programm (not C++ or C#), and you may need to copy&paste them in the right order...
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 1st, 2011 at 4:54:28 PM permalink
I downloaded CodeBlocks which uses the GCC compiler.

This line

DealerResults r = DealerStrategy(Dealer, CurrentDeck);

Gives a invalid initializer.

And this one

DealerResults DealerStrategy(Hand Dealer, Deck Remaining) {

Gives a Conflicting types for "DealerStrategy".

You might be right about order, since I don't think C# is picky in some places.

Here is the code I pasted in order.


#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <time.h>

#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))

#define DEALER_BUST 0
#define DEALER_STAND17 1
#define DEALER_STAND18 2
#define DEALER_STAND19 3
#define DEALER_STAND20 4
#define DEALER_STAND21 5
#define DEALER_BLACKJACK 6
#define DEALER_RESERVED 7

typedef struct {
float p[8]; // probability results for indexes DEALER_*
} DealerResults;

typedef struct {
char cards[10];
char total;
} Deck;

typedef struct {
char value; // playing value (1-31)
char soft; // 1=soft hand, 0=hard hand
char cards; // number of cards of this hand
} Hand;

const char cardName[10] = {'A','2','3','4','5','6','7','8','9','T'};
const char cardValue[10] = {11, 2, 3, 4, 5, 6, 7, 8, 9, 10};
const char cardSoft[10] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};




unsigned int PickCard(unsigned int C, Hand* H, Deck* D) {
if(D) {
D->cards[C ]--;
D->total--;
}
if(H) {
H->value += cardValue[C ];
H->soft += cardSoft[C ];
H->cards++;
while(H->value >= 22 && H->soft >= 1) {
H->value -= 10;
H->soft--;
}
}
return C;
}

void main() {
int N;
for (N = 1; N<=1024; N*=2)
{
printf("%uD: ", N);
int DCard=0;
for(DCard = 0; DCard < 10; DCard++) {
Deck CurrentDeck = {{N*4,N*4,N*4,N*4,N*4,N*4,N*4,N*4,N*4,N*16},N*52};
Hand Dealer = {0,0,0};
PickCard(DCard, &Dealer, &CurrentDeck);
DealerResults r = DealerStrategy(Dealer, CurrentDeck);
printf("%c: %f\t", cardName[DCard], r.p[DEALER_BUST]);
}
printf("\n");
}
}




DealerResults DealerStrategy(Hand Dealer, Deck Remaining) {
// printf("DealerStrategy(Deck=%u,%u,%u,%u,%u,%u,%u,%u,%u,%u\tDeckCount=%u)\n", Remaining[0], Remaining[1], Remaining[2], Remaining[3], Remaining[4], Remaining[5], Remaining[6], Remaining[7], Remaining[8], Remaining[9], DeckCount);
DealerResults ret = {{0,0,0,0,0,0,0,0}};
DealerResults r;

// Dealer stands on all 17, Dealer does not peek for Blackjack
if(Dealer.value < 17) {

int k;
for(k=0; k<10; k++) {
if (Remaining.cards[k] > 0) { // having chance of drawing ? (avoids crawling zero-contribution treebranches
float chance = (float)(Remaining.cards[k]) / Remaining.total; // chance of hitting in the remaining deck
if((Dealer.value + cardValue[k] >= 22) && (Dealer.soft + cardSoft[k] >= 1)) {
Dealer.value += cardValue[k] - 10;
Dealer.soft += cardSoft[k] - 1;
Dealer.cards++;
Remaining.cards[k]--;
Remaining.total--;
r = DealerStrategy(Dealer, Remaining);
int n;
for(n=0; n<8; n++) {
ret.p[n] += chance*r.p[n];
}
Dealer.value -= cardValue[k] - 10;
Dealer.soft -= cardSoft[k] - 1;
Dealer.cards--;
Remaining.cards[k]++;
Remaining.total++;
} else {
Dealer.value += cardValue[k];
Dealer.soft += cardSoft[k];
Dealer.cards++;
Remaining.cards[k]--;
Remaining.total--;
r = DealerStrategy(Dealer, Remaining);
int n;
for(n=0; n<8; n++) {
ret.p[n] += chance*r.p[n];
}
Dealer.value -= cardValue[k];
Dealer.soft -= cardSoft[k];
Dealer.cards--;
Remaining.cards[k]++;
Remaining.total++;
}
}
}
} else {
// Dealer Result table
if (Dealer.value >= 22) {
ret.p[DEALER_BUST] = 1.f; // Dealer busts
} else if(Dealer.value == 17) {
ret.p[DEALER_STAND17] = 1.f; // Dealer stands 17
} else if(Dealer.value == 18) {
ret.p[DEALER_STAND18] = 1.f; // Dealer stands 18
} else if(Dealer.value == 19) {
ret.p[DEALER_STAND19] = 1.f; // Dealer stands 19
} else if(Dealer.value == 20) {
ret.p[DEALER_STAND20] = 1.f; // Dealer stands 20
} else if(Dealer.value == 21 && Dealer.cards > 2) {
ret.p[DEALER_STAND21] = 1.f; // Dealer stands 21
} else if(Dealer.value == 21 && Dealer.cards == 2) {
ret.p[DEALER_BLACKJACK] = 1.f; // Dealer has Blackjack
} else {
printf("Dealer.value=%u\tsoft=%u\tcards=%u\n", Dealer.value, Dealer.soft, Dealer.cards);
assert(0);
}
}

return ret;
}
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 4th, 2011 at 3:38:16 PM permalink
Well, I redid the main logic in C#, and tweaked it a bit with my programming style. I have tested it with a single deck so far and it matches up one to one with the chart for hit on soft 17 single deck.

Keith

Of course this is just the main logic, you need to call it with the four parameters, which should be simple enough to figure out.

  
public double ActualBustChance(int cardsValueTotal, int numCardsLeft, bool soft, int[] cardsLeft)
{
if (cardsValueTotal == 0) { return 0.0; }
double bust = 0;
bool wasSoft = soft;
for (int i = 0; i < 10; i++)
{
double chanceOfCard = (double)cardsLeft / numCardsLeft;
if (chanceOfCard > 0)
{
cardsValueTotal += i + 1;
if (cardsValueTotal > 21 && soft) { soft = false; cardsValueTotal -= 10; }
if (i == 0 && cardsValueTotal <= 11) { cardsValueTotal += 10; soft = true; }
cardsLeft--;
numCardsLeft--;
if (cardsValueTotal < 17 || (cardsValueTotal == 17 && soft))
{
bust += chanceOfCard * ActualBustChance(cardsValueTotal, numCardsLeft, soft, cardsLeft);
}
else
{
if (cardsValueTotal > 21) { bust += chanceOfCard; }
}
cardsLeft++;
numCardsLeft++;
if (i == 0 && cardsValueTotal >= 12 && soft && !wasSoft) { cardsValueTotal -= 10; }
if (cardsValueTotal >= 12 && wasSoft && !soft) { cardsValueTotal += 10; }
cardsValueTotal -= (i + 1);
soft = wasSoft;
}
}
return bust;
}
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
May 4th, 2011 at 4:11:15 PM permalink
Nice work. If you remove the cardsLeft[ i ]-- and numCardsLeft[ i ]-- (and opposite cardsLeft[ i ]++ and numCardsLeft[ i ]++) you can also study infinite decks (with proper initial distributions).

Further, supply of other probabiltiies (stand on 19) is done the same (and can be implemented in the same recursive loop). With small adjustments, one can of course also calculate other similar games as Double Exposure or Spanish 21.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 4th, 2011 at 4:59:55 PM permalink
Thanks, Yes, I do see where I could calc things like if total=17, or 18, etc. And a special if for the Ace plus ten. I do see how simple those would be to add to this. I am also happy at how quickly this calculates the result. The key to that of course is only ten possibilities at each level.

Any way, thanks for the help.

If I get a chance I may look back at the "excel" one that subtracted used cards and see why it wasn't closer. But I may not spend much time on it.

Keith
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
May 5th, 2011 at 8:52:05 AM permalink
If you have more questions, or like a good discussion, you can write me on rumple81@web.de
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 5th, 2011 at 9:43:32 AM permalink
Thanks. That is very kind of you.
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
May 5th, 2011 at 11:11:07 PM permalink
Good work guys, this thread has been interesting to read. I didn't comment on the progamming part because I am not familiar with coding in C. Anyways, could either of you guys send their complete program to me? Preferably the program should also calculate the probabilities for dealer 17,18,19,... given starting conditions, like in MangoJ's Excel sheet. I would like to play with a program like this and testing different starting conditions.
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 7th, 2011 at 9:26:19 AM permalink
Well, at the moment, I am not calculating 17, 18, etc. as I wasn't interested in those. Also, in the current shape you would need to to hard code the values into a program and compile, as I don't have a front end like what you are looking for. So it would take some work to do this.

Have you looked at some of the programs that are already out there?

http://www.qfit.com/online-blackjack-calculator.htm

Specifically this one - http://www.qfit.com/CVDPC.htm
Jufo81
Jufo81
  • Threads: 6
  • Posts: 344
Joined: May 23, 2010
May 7th, 2011 at 11:53:05 AM permalink
Quote: loveTheOdds

Well, at the moment, I am not calculating 17, 18, etc. as I wasn't interested in those. Also, in the current shape you would need to to hard code the values into a program and compile, as I don't have a front end like what you are looking for. So it would take some work to do this.

Have you looked at some of the programs that are already out there?

http://www.qfit.com/online-blackjack-calculator.htm

Specifically this one - http://www.qfit.com/CVDPC.htm



Yeah, also MangoJ replied to me by PM and realize I was asking a bit too much ;) Sorry about that. The link above seems to calculate the exact same thing based on the cards remaining in the deck(s). Do you guys get the same results with your program as with the above link?

Of course, since I am good at programing with Java, I could code a similar routine you guys did without too much work. But with your above Qfit link it seems a bit unnecessary at this point. Extending the possibilities, one could also extend the program to calculate player's optimal strategy based on cards exposed, similar to this calculator:

http://www.bewersdorff-online.de/black-jack/
loveTheOdds
loveTheOdds
  • Threads: 1
  • Posts: 30
Joined: Apr 27, 2011
May 7th, 2011 at 12:08:58 PM permalink
I also know java. You could practically drop my above program straight into Java. Then create a Main to make use of it.

My code shows a slightly different calc then the link I sent. It is close, but slightly different. Not sure why.

The link you sent seems perfect for you. Nice find.
  • Jump to: