Finding a theoretical explanation for a simulated probability distribution of a casino game

79 Views Asked by At

I am developing a casino game for a statistics project. The rules are as follows:

This game costs \$1 to play. The player rolls a six sided die. If the rolled face is odd, the player loses and is given \$0. If the face is even, they earn a prize of \$1. The player is given the option to accept their payout or keep playing after each successful roll. If they choose to roll again, they will earn an additional dollar for each successful even roll. If they ever roll an odd, they will lose all earnings and receive \$0. The player continues until they lose by rolling an odd number or until they have rolled 5 times (\$5 maximum payout).

I was unable to determine the probability distribution for each payout theoretically, so I instead simulated them using Python (note: I am a novice programmer). My simulation assumes a 50% probability of quitting after each successful roll.

import random

total_winnings = 0
payoutFrequency = {0: 0, 1:0, 2:0, 3:0, 4:0, 5:0}

# Let zero be odd and 1 be even
chooseList = [0, 1]

def play_game():
    winnings = 0
    roll = 0
    while roll < 5:
        choice = random.choice(chooseList)
        if choice == 1:
            winnings += 1
            # Simulate choosing to quit
            # Assume 50% chance of quitting after each win
            quitDecision = random.choice(chooseList)
            if quitDecision == 1:
                break
        else:
            winnings = 0
            break
        roll += 1
    return winnings

simulations = 10000000
for i in range(simulations):
    payout = play_game()
    total_winnings += payout
    payoutFrequency[payout] += 1
    
print(f"Expected Winnings: {total_winnings/simulations}")
print(f"""Probability Distributions of Payouts:\n
        $0: {payoutFrequency[0]/simulations}\n
    $1: {payoutFrequency[1]/simulations}\n
        $2: {payoutFrequency[2]/simulations}\n
    $3: {payoutFrequency[3]/simulations}\n
        $4: {payoutFrequency[4]/simulations}\n
    $5: {payoutFrequency[5]/simulations}""")

Running the simulation 10,000,000 times returned the following results:

Expected Winnings: 0.4471606
Probability Distributions of Payouts:

        $0: 0.6660241

        $1: 0.2500339

        $2: 0.0624574

        $3: 0.0156626

        $4: 0.0038859

        $5: 0.0019361> 

These coordinate to probabilities (I assume) are 2/3, 1/4, 1/16, 1/64, 1/256, and 1/512, respectively. Does anyone have an idea or explanation on how to achieve these numbers theoretically?

Edit: This game is purposefully meant to make a profit for the casino. The expected value should be negative after the buy-in is subtracted. Ideally, this game would have the allure of logic and control so that players will be enticed to play.

1

There are 1 best solutions below

1
On BEST ANSWER

I will use $H$ to mean "heads", $T$ to mean "tails", $P$ to mean "play again", and $Q$ to mean quit. For example, when I write $$ HPHPHQ, $$ what I mean is the series of events where the first flip is heads, then the player chooses to play again, then the second flip is heads, then the player chooses to play again, then the third flip is heads, after which the player quits. For the situation above, the player receives a payout \$3.

To compute the probabilities you want, we just need to enumerate all of the possible ways each payout can happen, and add up the probabilities of each way.

  1. The only way to get a payout of \$1 is the sequence $HQ$ (you must win the first flip, then quit immediately). The probability of this is $(1/2)\times (1/2)=(1/2)^2=25\%$, because there is a $1/2$ chance you flip $H$, and then a $1/2$ chance the player quits.

  2. The only way to get a payout of \$2 is the sequence $HPHQ$, which has a probability of $(1/2)^4=1/16=6.25\%$.

  3. The only way to get a payout of \$3 is the sequence $HPHPHQ$, which has a probability of $(1/2)^6=1.5625\%$.

  4. The only way to get a payout of \$4 is the sequence $HPHPHPHQ$, which has a probability of $(1/2)^8\approx 0.39\%$.

  5. The only way to get a payout of \$5 is the sequence $HPHPHPHPH$, which has a probability of $(1/2)^9\approx 0.195\%$.

  6. There are lots of ways to get a payout of \$0. These include $T$, $HPT$, $HPHPT$, $HPHPHPT$, and $HPHPHPHPT$. Adding up the probabilities of each of these, we get $$ \frac12+\frac18+\frac1{32}+\frac1{128}+\frac1{512}=\frac{341}{512}= 66.6015625\% $$Note that this is NOT equal to $2/3$, though it is pretty close.