## History of Monte Carlo Simulation

One could say that the modern era of Monte Carlo simulation came about as part of the Manhattan Project when scientists created a computer program which created random combinations of known variables to simulate the range of possible nuclear explosions. They nicknamed the program Monte Carlo, after the famous gaming mecca.

To simplify the technique to a bare minimum, the technique is to take a large number of samples from a probability distribution (what is technically called a PDF - probability density function) or from a number of pdf's, and then compute and record the result. If we sample enough, the results will eventually closely match the actual probabilities.

In the simple case of flipping a coin you can see that this technique is more difficult than calculating the probability would be. For a coin we understand that there is 50% chance of each outcome. If we add a second coin, the probability gets a bit more complex but is still fairly easy to calculate. But once we get beyond a few coins or start dealing with playing cards most people quickly get confused and would have a difficult time coming up with equations which describe the probable outcomes.

This is where Monte Carlo simulation comes in. Rather than having to think about it, you just get a computer to flip the coin or deal the cards a large enough number of times and eventually the results will match the probabilities of each result. If you get a computer to simulate a coin flip 1000 times, it will be very close to 500 heads and 500 tails. It may not be exactly 500, but it will be very close.

As a concrete example of this I've used excel to run a simulation of a blackjack hand. With a modern PC Excel can do millions of trials in a minute or so. It would be quite time consuming to do this by hand. The 10 million trial results shown in the spreadsheet would require dealing more than a thousand miles of playing cards laid end to end. And the probability equations necessary to predict the results mathematically are more than I can easily comprehend.

## The Problem

In the game of Blackjack there is little that the player has to go by. They can see the cards in their hand and one of the dealer's cards. Since they are playing against the dealer, they do not care what the other player's cards may be, except perhaps to try and infer which cards are left in the deck.

Given this situation, the most useful information the player can have is what the probable outcome of the dealer's hand will be. In other words, they need to know what hand they must beat.

There are some rules that the dealer must follow which make this calculation a bit complicated. First the dealer must take another card if his total is 16 or less. He is not allowed to take another card if his total is 17 or higher. And if his total is greater than 21 it is considered a "bust" and he loses to any hands which have not already bust. On top of that, the Ace can be counted as being worth 1 or 11 depending on the choice of the dealer (this model presumes that a dealer may not draw another card on a "soft" 17 or higher, that is one where the Ace is counted as 11).

## What you can do with this

This spreadsheet is useful not only to demonstrate the principles of monte-carlo simulation, or to show you how to program with VBA or even to determine what the odds are of a dealer ending up with a certain hand if they have a particular card showing, but to also show what the odds are if the deck changes. For example it is said that a deck which has more than the usual number of 5's and 10's remaining is generally not in the dealer's favor. Using this, you can adjust the deck and quantify what the odds really are. Of course, if you want to put this into practice you need to count the cards that come up while you are playing and modify your betting. This is frowned on by casinos.

Here is the spreadsheet you can download:

Download ZIP file

Back to Excel main page

Excel Page