Simulating a roulette strategy


In betting, there is a strategy known as the Martingale betting system where the gambler simply doubles their bet after each loss, so their first eventual win covers all the previous losses + a profit equal to the original stake. This strategy is designed for games with roughly 50/50 odds, such as roulette (where the odds are slightly less than 50/50). For example, if we lose our first roulette $1 bet, we will bet $2 on the next bet trying to make up for the previous loss. If we lose that bet, we will then bet $4 and so on until we finally win a roll and reset to our initial bet of $1 (taking home the $1 profit of the original stake).

Given this information, write a function that can simulate the bankroll of an individual who employs this strategy playing roulette over time. You can assume the gambler starts with $5000 and makes an initial bet of $1.


Access restricted

Subscribe to premium account to see the solution.

Get premium now