The Monte Carlo method works by using a known probability distribution and drawing from it a specified number of times. To explore this concept, I created a simulation of a roulette game in Wolfram Mathematica. In this project, I explore how to calculate expected value using the monte carlo method and how using a popular betting method affects our results.
To have an analytical baseline to compare results with, I calculated the expected value of betting on red (using $5 bets). The simulation results should be in line with these analytical results
It's always nice when the analytical and the experimental results converge. This will be a good way to check that.
The Mathematica code is set up to let the user explore different betting strategies and game configurations. The user can modify variables like bankroll, minimum and maximum bet, rouletty style, etc. The default values are numbers that I have seen in most casino games (except for the bank roll amount, I haven't seen much of that). The live plot view feature works well with trials under 1000 but times out if evaluation takes too long.
To model the spin of a roulette wheel I describe each spin as a binomially distributed (result is win or lose), independent event. The probability of success of depends on the type of bet and the type of roulette table- the European tables have one 0 and the American tables have two 0's!. A random rumber is generated based on the odds of the particular bet and a -1 is returned if the bet results in a loss and a bet multiplier is returned if the bet is succesful. Once we have this model for a basic bet, we can wrap it around code simulates a spin with our betting parameters and repeat.
An interactive web version is also avaialble here (account needed?): https://mathematica.wolframcloud.com/app/objects/bd9c0c88-9011-47c7-9dff-afd74bc8e404
You can view results in the img directory. Here are some of them:
20-bet games. Random black or red betting strategy and double down after every loss strategy
100-bet games. Random black or red betting strategy and double down after every loss strategy
To see more projects please visit http://ajumpa.com/