The Statistics of Blackjack

 


Let’s find out through a simple statistical analysis!

Setting the scene
This article exploits a simulation tool for Blackjack built with R to deduce an optimal strategy and the associated probabilities.

The rules used for the simulations are:
  • Each player, including the dealer, starts with two cards. One of the dealer’s cards is hidden and will be revealed at the end of the round, when comes the dealer’s turn to play.

  • The goal is to ask for cards to beat the dealer’s hand without exceeding 21, each card accounting for its nominal value (Kings, Queens, and Jacks are worth 10). Aces are worth 1 or 11, whichever value gives the best score without busting. If a hand has an ace whose value is 11, it is called soft, and the opposite is called a hard hand.

  • If the player exceeds 21 (bust), no matter the dealer’s score, the dealer wins the bet. If the dealer busts and the player does not, the player wins. In case of similar scores under 21, the round results in a draw. In all other cases, the higher score wins the round.

  • The dealer pays the bet 1 to 1, except for a natural Blackjack (Ace + card whose value is 10) that pays 3 to 2.

  • At each move, the player can hit (ask for a card), stand (remain at its current position), or double (the bet is doubled but only one more card will be drawn).

  • When the player has two identical cards, he can split, which means he can transform his pair into two separate hands that will be played independently.

Basic strategy


The most basic strategy one could think about is standing once the score reaches a certain threshold.

In terms of code, we just need to filter the dataset to retrieve one line by game id that corresponds to the first score that exceeds the threshold, or the first score if hit that does so if the first condition is not met.

Applying this strategy to the dataset for each threshold from 2 to 21, we get the following results after aggregation.

The graph above represents the expected earnings for each round (in percent of the gambled amount) with the distribution of outcomes.


The optimal strategy

To find the optimal strategy, we first need a metric for optimization. We will use the expected earnings after a move.

Computing this metric for a given hand (score & if the hand is soft), requires knowing:
  • the next possible hands when hitting, with the probability to transition to each one of them;
  • the associated expected earnings for those hands, based on the moves given by the strategy we aim at defining.


We thus have a recursive problem to handle, since we first need to estimate the possible later moves of the round, dealer’s score being constant. This requires implementing a loop going backward on scores. Nevertheless, the possibility to have a hard or soft hand implies to also consider this when ordering the steps.

The following chart describes the transitions between hands.



  • First the hard hands with a score higher than 10.
  • Then the soft hands.
  • Finally, the hard hands with a score lower than 9.

How long can I enjoy a Blackjack game before going broke?


Testing this strategy against the simulations (with the test strategy R script),we can estimate the average accumulated earnings after a certain number of rounds, along with some quantile intervals.


                                          Earnings scenarios for up to 1,000 rounds for a steady bet of 1

Comments

Popular Posts