drum
drum
  • Threads: 2
  • Posts: 9
Joined: Apr 10, 2015
April 10th, 2015 at 9:25:15 AM permalink
I've been working on some code in my spare time, that uses brute force to work out the odds for any given player hand\dealer card.

I've got the dealer to stand on a soft 17, and am currently only using one deck of cards.

However my figures are coming out wildly different from what I would expect, and from published figure I see.

Taking a sample where the dealer has an 8 and the player a a 9 and 5 totalling 14. And the player stands for the sake of simplicity. So basically if the dealer busts player wins, otherwise dealer wins.

My code gives me 266124 possible variations where the dealer Busts, and only 144407 where the dealer wins, which I reckon gives the player a 65% chance of winning. However the published odds atare 24% chance of going bust. Somehow I'm managing to find lots of extra ways for the dealer to bust.

I do allow the dealer to hit as many time as possible, so if by chance he got 8,5,A,A,A,A I would count that as a soft 17, so would stand on that.

Can anybody suggest why my odds might be so different to the accepted norm?
OnceDear
OnceDear
  • Threads: 64
  • Posts: 7496
Joined: Jun 1, 2014
April 10th, 2015 at 10:06:33 AM permalink
Hi,
I've done something towards this with 8 decks. Assume dealer stands on soft 17.
By my calculation, if the dealer's up card is an 8, then there are 865 possible outcomes (Ignoring suits)
Of those,
17 : 96 ways
18 : 96 ways
19 : 96 ways
20 : 95 ways
21 : 95 ways
Bust : 387 ways

Ah... Silly me. That ignored that there are 4 times as many tens as any other card... Back soon :)

After revisiting my workbook... The counts above are OK, but don't even touch on the relative probabilities.

I actually ended up with
_______17__________18________19_________20__________21__________BJ_________Bust
_______0.14522_____0.13932____0.13363_____0.17971_____0.07284_____0.04745_____0.28184
1______0.13021_____0.13081____0.13064_____0.13088_____0.05359_____0.30843_____0.11543
2______0.13969_____0.13452____0.12993_____0.12402_____0.11831_____0.00000_____0.35353
3______0.13448_____0.13052____0.12531_____0.12069_____0.11487_____0.00000_____0.37412
4______0.13054_____0.12453____0.12130_____0.11645_____0.11171_____0.00000_____0.39547
5______0.12195_____0.12239____0.11761_____0.11213_____0.10802_____0.00000_____0.41790
6______0.16564_____0.10621____0.10639_____0.10159_____0.09725_____0.00000_____0.42292
7______0.36905_____0.13790____0.07848_____0.07867_____0.07388_____0.00000_____0.26203
8______0.12885_____0.35980____0.12868_____0.06926_____0.06945_____0.00000_____0.24395
9______0.12023_____0.11801____0.35158_____0.12028_____0.06086_____0.00000_____0.22904
10_____0.11179_____0.11161____0.11181_____0.34056_____0.03474_____0.07711_____0.21238
Psalm 25:16 Turn to me and be gracious to me, for I am lonely and afflicted. Proverbs 18:2 A fool finds no satisfaction in trying to understand, for he would rather express his own opinion.
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
April 10th, 2015 at 10:10:50 AM permalink
Quote: drum


I do allow the dealer to hit as many time as possible, so if by chance he got 8,5,A,A,A,A I would count that as a soft 17, so would stand on that.



This hand is a hard 17, which should not be hit anyhow.
I heart Crystal Math.
ThatDonGuy
ThatDonGuy
  • Threads: 122
  • Posts: 6557
Joined: Jun 22, 2011
April 10th, 2015 at 10:16:14 AM permalink
Quote: drum

Taking a sample where the dealer has an 8 and the player a a 9 and 5 totalling 14. And the player stands for the sake of simplicity. So basically if the dealer busts player wins, otherwise dealer wins.

My code gives me 266124 possible variations where the dealer Busts, and only 144407 where the dealer wins


How are you getting these numbers?
Is it something like:
#1 - 8 A - win
#2 - 8 K - win
#3 - 8 Q - win
#4 - 8 J - win
#5 - 8 10 - win
#6 - 8 9 - win
#7 - 8 8 A - win
#8 - 8 8 K - bust
...
#20 - 8 8 A - win
#21 - 8 7 A A - win
#22 - 8 7 A K - bust
#23 - 8 7 A Q - bust
...
and so on?

If so, then you need to calculate the probability of each variation separately.
8 K is 4/50 x 4/49.
However, 8 8 A is 4/50 x 3/49 x 4/48.
drum
drum
  • Threads: 2
  • Posts: 9
Joined: Apr 10, 2015
April 10th, 2015 at 10:18:00 AM permalink
Quote: CrystalMath

This hand is a hard 17, which should not be hit anyhow.



Sorry my mistake ofcourse it is.
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
April 10th, 2015 at 10:24:59 AM permalink
Hopefully this can help you in tracking down your error.

Here is the distribution I calculate for the dealer using 1 deck and standing on soft 17.

Ending Total Probability
17 0.114231947
18 0.376688515
19 0.131140182
20 0.068020072
21 0.070082413
Bust 0.239836871
I heart Crystal Math.
drum
drum
  • Threads: 2
  • Posts: 9
Joined: Apr 10, 2015
April 10th, 2015 at 10:30:17 AM permalink
Quote: ThatDonGuy

How are you getting these numbers?


If so, then you need to calculate the probability of each variation separately.
8 K is 4/50 x 4/49.
However, 8 8 A is 4/50 x 3/49 x 4/48.



I'm actually iterating through all the possible hand combinations, and deciding on hit, stand, bust. either stand or bust will count into my records, giving the numbers I quoted. So I actually count a 8 of hearts as a different card to an 8 of diamonds and so on, I also had a version of the code that when it used a card looked at the number same value cards left in the deck, and multiplied up which gave the same results, but I've gone back to the basic iterate though all the cards to simplify things.

Are you saying that if start that what I should be doing is working out the probability at each deal separately and multiplying them so for the hand I quoted of
player has 9,5 and dealer starts with

dealer prob 8,5,A,A,A,A

3/49 x 4/48 x 3/47 x 2/46 x 1/45

Then to get the odds of going bust I add all the bust ones together, or to get the odds of beating the player, I add all the number ones together (in this instance)

Is that right?
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 2997
Joined: Jun 17, 2011
April 10th, 2015 at 11:50:51 AM permalink
Sounds right.

The easiest way - as it can fit in a spreadsheet - is to list all the possible order of cards the dealer can draw (consider there to be "Ten" cards rather than 10, J, Q and K) and accept there are 16 in a deck. Also remember to keep different order (e.g. 8 5 7, 8 7 5).

Assume the player has (say) T 7, work out the probabilities for each combinations, e.g. 8 5 7 = would be 4/49 x 3/48; and add them all up.

btw it might be easier to add a variable (number_of_decks), set the cards gone (i.e. what the player has) and use something like "4 * number_of_decks"-how_many_seen_so_far , for future use!
drum
drum
  • Threads: 2
  • Posts: 9
Joined: Apr 10, 2015
April 10th, 2015 at 11:50:56 AM permalink
Thanks guys using the formula I described above I now get a probability of the dealer going bust of 0.239836871357
  • Jump to: