Skip to content

Monte Carlo simulation of roulette game on Mathematica

Notifications You must be signed in to change notification settings

arturju/rouletteMonteCarlo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roulette Simulation Using the Monte Carlo Method

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.

gif

Analysis

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

Eq1
Eq2
Eq3

It's always nice when the analytical and the experimental results converge. This will be a good way to check that.

Mathematica Code

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. roulette Model 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

Results

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 randomBet20Games doubleDown20Games

100-bet games. Random black or red betting strategy and double down after every loss strategy randomBet100Games doubleDown100Games

1000-bet games randomBet1kGames doubleDown1kGames

Resources

To see more projects please visit http://ajumpa.com/

About

Monte Carlo simulation of roulette game on Mathematica

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published