Infinite Money in Roulette (Martingale Betting System)


MicroProject Overview

The "Martingale Betting System" is a specific strategy that, when applied to the game of Roulette, involves the following actions:

  • You will initially start by betting a small amount (ex: $1.00) on red.
  • Based on the outcome:
    • If you win (the wheel lands on red), you will win your bet. You have made $1.00 and you can repeat again with $1.00.
    • Each time you lose, you double your bet (initially, after one loss, a $2.00 bet; then $4.00; then $8.00; and so on) until you win.

Using this strategy, every bet will always recover all previous losses and ALWAYS result in a winning bet netting a win of $1.00. (Ex: A $4.00 bet that wins only happens after a $1.00 and $2.00 loss, still resulting in a +$1.00 net win.)

Therefore, mathematically, this betting strategy will result in an infinite increasing amount of money so long as you play the game long enough! In this MicroProject, we will explore this claim and use simulation to play Roulette using the Martingale Betting System. Let's nerd out! :)

MicroProject in Visual Studio Code
MicroProject in Visual Studio Code
Infinite Money using Martingale Betting System
Infinite Money using Martingale Betting System
Martingale Betting System with Table Limits
Martingale Betting System with Table Limits

First Time Doing a MicroProject?

Each MicroProject starts with a notebook that we provide to you to get started! You will need to configure a git repository to connect to our `microprojects` remote where we release the starter notebook.


Fetch the Initial Files

In your terminal, navigate to your GitHub repository and merge the initial files by running the following commands:

git fetch microprojects
git merge microprojects/microproject-infinite-money-in-roulette-martingale --allow-unrelated-histories -m "Merging initial files"

Complete the Notebook

If the commands above were successful, you have merged in the initial files to start on the MicroProject.

  • Find the new microproject-infinite-money-in-roulette-martingale folder.
  • Open microproject-infinite-money-in-roulette-martingale.ipynb and complete the MicroProject!

Commit and Grade Your Notebook

Once you have finished your notebook, you must use the built-in GitHub Action to preform automated grading of your MicroProject notebook! You will need to commit your work and then manually run the GitHub Action.

Commit Your Work

To commit your notebook, run the standard git commands in your terminal:

git add -u
git commit -m "microproject completed"
git push

Grade Your Notebook

To grade your notebook, you will need to visit your GitHub repository in your browser.

  • Visit your GitHub repository in your browser
  • Click on the "Actions" tab
  • Under "Workflows", find the workflow for this microproject
  • Click the "Run Workflow" in the blue box, and then the green "Run Workflow"
  • After about 10 seconds, you should see a new job that has started running
    • You can click on the job to watch it run in real-time
    • It will take ~1 minute to run and grade
  • Once the running is complete, the autograding summary will be available!