Wednesday 17 August 2016

Blackjack house edge

Statistically speaking, Blackjack is probably the only casino game where you can win money in the long run.

Inspired by the movie <21>, I decided to write a Java program (https://github.com/sunmingtao/blackjack) to find out the house edge for the following two scenarios:
  1. The player employs the basic strategy.
  2. The player counts the card and bets only when the situation favours him.
What is basic strategy?

Basic strategy, simply put, is the strategy that enables you to lose the least money to the casino in the long run. Given a hand against a specific dealer’s face up card, the strategy chart will tell you which action to take. If you decide to disobey the strategy chart, it will cause you to lose more money.

Since  Blackjack’s rules vary from casino to casino, there is a basic strategy for each set of rules.

My program assumes the use of American rules (with hole card), as opposed to European/Australian rules (without hole card). Also assumed is the following variation of rules, which is quite common in America.

  • Hole card games — dealer peeks for blackjack on 10s and Ace upcards.
  • The dealer must stand on Soft-17.
  • Blackjack payout is 3 to 2 odds.
  • 21 on split Aces cannot count as a player blackjack.
  • We can double down on any hand total.
  • We can double down after splitting.
  • We can split hands up to three times, making four total hands.
  • We can split Aces only once, and only take one card to split Aces.
  • Unlike 10-valued cards can be split; 10-card and Jack, etc.
  • Late surrender is allowed.

Here is the basic strategy chart corresponding to the above rules.














































S = Stand
H = Hit
Dh = Double (if not allowed, then hit)
Ds = Double (if not allowed, then stand)
SP = Split
SU = Surrender (if not allowed, then hit)

How do I work out the house edge?

First off, I don’t know how to calculate the precise odds mathematically. There are so many combinations that I think it’s only theoretically possible to do the precise calculation. But precision doesn’t really matter here. Knowing a range is more than sufficient to help us make a decision. If we know the house edge of Baccarat falls between 0.5% and 0.6% while Baccarat is 1%-1.2%, we want to stay a bit away from Baccarat table.

The approach I take is Monte Carlo method, which is to simulate the game played between player and dealer for a large number of times.

Number of hands simulated House edge
89412575 0.36
89411293 0.38
89409262 0.35

We see a house edge between 0.35% and 0.38%. This means if we bet $100 every time, after 100 hands, we are expected to lose 35-38 dollars on average.

Now let’s see how card counting reverses the house edge.

How does card counting work?

The more big cards (10-A) remain in the deck, the more advantage shifts to the player’s side.  The rationale behind this system is that with more big cards remaining, the player is more likely to hit a natural blackjack, which pays 3 to 2. And the dealer is more likely to bust because he is obliged to hit on 4 or 5 while the player can choose to stand. 

To count card is simple, start the counter as 0, when you see 2-6, add 1 to the counter. When you see 10-A, subtract 1 from the counter. Do nothing when you see 7-9. 

We call the value of this counter as ‘running count’. The casino normally uses 6-8 decks of cards, so we need to translate our information into ‘true count’, which means the ‘running count’ per remaining deck. 

For example, the ‘running count’ is 5, and there are about 5 decks of cards remaining. The ‘true count’ would be 1. 

So when can you start betting? When ‘true count’ >= 1. At least it’s what the online article says. However, my program actually proves using ‘running count’ is almost as effective as ‘true count’.

Let's compare the result between true count and running count.

When true count > 1

Number of hands simulated Number of hands bet House edge per hand bet House edge per hand dealt
89413874 28600935 -1.10 -0.35
89411394 28576145 -1.07 -0.34
89409522 28573179 -1.08 -0.35

When running count > 1

Number of hands simulated Number of hands bet House edge per hand bet House edge per hand dealt
89409623 39847047 -0.73 -0.32
89412203 39847047 -0.77 -0.34
89412267 39816672 -0.79 -0.35

We see a player advantage in both cases. While it is undeniable that true count's edge is significantly higher than running count's in terms of 'per hand bet' (1.08 vs 0.77), it doesn't mean you can make significantly more money using true count. We must take the opportunity cost into consideration.

While using true count, there is only roughly 30% of the time when you can bet. The rest of time you have to sit out. It's highly unlikely you can tap into this idle period to make any money because you still need to be preoccupied with keeping track of the count. Consequently the real house edge that will reflect in your hourly earning rate is based on the total hands dealt, whether you play or not. And when we compare the house edge per hand dealt, the difference can hardly be said to have any statistical significance.

Finally let's do some rough estimate for a card counting pro's hourly rate. Suppose a dealer deals 100 hands an hour and the pro bets $100 every time, he's then earning $35 an hour on average. Double the stake, he will be earning $70 an hour. To stay under the radar, his stake probably can't go higher than that. Otherwise the casino will soon catch on and ban him. Upping the stake will also face the bankroll issue. We must bear in mind that the $35 or the $70 hourly rate doesn't mean you will be constantly earning this amount hour by hour like ordinary office workers do. You could win $500 this hour and lose $300 next hour. If you don't have a bankroll large enough, chances are you will go broke before you get a chance to win it back.