I’m writing a program to calculate the EV for various hands in Blackjack.
I’ve checked my results against the tables at the usually reliable Wizard Of Odds
In most cases I calculate exactly the same values they do, except in a few cases. These cases being where the dealer has an ace or a ten showing. In such cases my program will *always *calculate a result slightly different to WOO’s, and as far as I can tell, this is the only occasion it ever does so.
The difference is only slight. For example, given a 6 deck shoe, stand on soft 17, dealer shows a ten, player has A8 the odds are:
WOO Mine
stand +0.063321 0.064313
hit -0.087616 0.086395
double -0.233592 0.226191
My program uses a recursive algorithm. At each loop, the program considers in turn every card that might be drawn next, the chance of drawing that card, and the EV for that card:
total EV =
chance of ace * EV for ace +
chance of two * EV for two +
chance of three * EV for three +
...
The calculation of the EV for each card appears to work correctly.
After long consideration of the matter, I think the error must lie in the calculation of the chance of drawing a particular card. This will be slightly different depending if the dealer has an ace or ten showing. And this is the only difference between the ones I’m getting right, and those I’m getting wrong.
Note that I’m assuming the dealer has checked for Blackjack, and hasn’t got it. Thus if the dealer shows a ten, the hole card cannot be an ace, and vice-versa. So, for example, assuming a single deck, player has stood on 4,8,6, dealer shows a ten, I figure that there are 44 possible cards the dealer might have for the hole card.
Chance of an ace = 0
chance of a 2 = 4 in 44
chance of a 3 = 4 in 44
chance of a 4 = 3 in 44
chance of a 5 = 4 in 44
chance of a 6 = 3 in 44
chance of a 7 = 4 in 44
chance of a 8 = 3 in 44
chance of a 9 = 4 in 44
chance of a 10 = 15 in 44
The above is the logic I’m using at the moment, but it appears to give incorrect results.
Here’s the section of the program
In the following, cards_in_deck is a structure that holds information about the cards not in play and still in the shoe, available to be dealt.
cards_in_deck.cards_remaining is an integer showing the total number of cards left
cards_in_deck.Ace is an integer showing the number of Aces left
If dealer_hand = "A" And dealer_checks_for_blackjack Then
'----------------------------------------------
' This code operates only if dealer has a single
' ACE showing, and checks for Blackjack. We know
' the hole card cannot be a TEN, so the chance of
' any other card increases.
'----------------------------------------------
search_type = "ace_showing"
number_of_cards = cards_in_deck.cards_remaining - cards_in_deck.ten
chance_of_ace = cards_in_deck.Ace / number_of_cards
chance_of_ten = 0
ElseIf dealer_hand = "X" And dealer_checks_for_blackjack Then
'----------------------------------------------
' This code operates only if dealer has a single
' TEN showing, and checks for Blackjack. We know
' the hole card cannot be an ACE, so the chance of
' any other card increases.
'----------------------------------------------
search_type = "ten showing"
number_of_cards = cards_in_deck.cards_remaining - cards_in_deck.Ace
chance_of_ace = 0
chance_of_ten = cards_in_deck.ten / number_of_cards
Else
'----------------------------------------------
' This code operates in all other situations.
' 1) the dealer has a 2-9 showing or
' 2) dealer does not check for Blackjack
' 3) dealer has already drawn one or more cards.
'----------------------------------------------
search_type = "normal"
number_of_cards = cards_in_deck.cards_remaining
chance_of_ace = cards_in_deck.Ace / number_of_cards
chance_of_ten = cards_in_deck.ten / number_of_cards
End If
chance_of_two = cards_in_deck.two / number_of_cards
chance_of_three = cards_in_deck.three / number_of_cards
chance_of_four = cards_in_deck.four / number_of_cards
chance_of_five = cards_in_deck.five / number_of_cards
chance_of_six = cards_in_deck.six / number_of_cards
chance_of_seven = cards_in_deck.seven / number_of_cards
chance_of_eight = cards_in_deck.eight / number_of_cards
chance_of_nine = cards_in_deck.nine / number_of_cards
...
So, what am I missing?
