Search code examples
javastatisticsartificial-intelligenceblackjack

Probability analysis for blackjack


I'm making an AI for blackjack and currently I'm keeping track of all the card that have been played and I calculate the probability of the AI for busting with it's current hand.

Right now I'm trying to figure out how to calculate the probability of the dealer busting or beating my AI. In the Blackjack game the dealer has 1 face up card and 1 face down card. Statistics isn't really my strong suit, but i want to calculate the chance that the "wild card" would beat my AI. Can anyone suggest a equation for this?

https://github.com/onetrueallen/blackjackai/blob/master/src/CountCards.java


Solution

  • I think something like this might work:

    1. Take the complete set of cards and subtract all the played cards, the visible dealer's card and the cards in your hand. This leaves you with the set of the unknown cards
    2. Calculate the value of your hand's cards
    3. Create a new set that consists of a pair for each unknown card combined with the dealer's known card. Calculate their values.
    4. Calculate how many of these values would beat your hand's value.
    5. Divide that number by the total number of pairs for the set dealer's hand plus unknown card.
    6. That's your probability of the dealer beating you.