Roulette Odds

Roulette odds are the closest to 50-50 if it wasn't for the zero. Inevitably, the player loses. A simple simulation goes as follows:

1. Start with $1000

2. In each round, play $5

3. If you get the number right, you get back the original amount played, plus five times it

4. If you get the parity right (even or odd), you get back the original amount played, plus two times it

5. Rule #4 doesn't apply to zero. If the tossed number is zero, only rule #3 applies

6. Play until you run out of money


In my simulation (code down below), I got few insights:

A. On average you lose all your money after 200 rounds

B. Maximum that I could get was ~400,000 rounds (and near $250,000) before losing it all (see chart below)

C. If you remove the zero restriction, there is a possibility of convergence and stability where you end up with somewhere between $30,000 and $100,000

Code is down below, cheers, ACC.


public void PlayRoulette()
{
    int amount = 1000;
    int playAmount = 5;

    int rounds = 0;
    while (amount >= playAmount)
    {
        Console.WriteLine("{0};{1}",rounds, amount);
        amount += PlayRoulette((new Random((int)(DateTime.Now.Ticks % Int32.MaxValue))).Next(0, 37), playAmount) - playAmount;
        rounds++;
    }
}

private int PlayRoulette(int number, int amount)
{
    int retVal = 0;

    int toss = (new Random((int)((DateTime.Now.Ticks + 1) % Int32.MaxValue))).Next(0, 37);

    if (toss == number) retVal = 6 * amount;
    else if (toss != 0 && number % 2 == toss % 2) retVal = 2 * amount;

    return retVal;
}

Comments

Popular posts from this blog

Advent of Code - Day 6, 2024: BFS and FSM

Advent of Code - Day 7, 2024: Backtracking and Eval

Connected Components in a Graph II