Probability of Playing Next Rounds

57 Views Asked by At

I want to calculate an average win in a game. Thus, I'm trying to calculate the probability of playing an $n$th game. The rules of the game are the following:

  • A player has to draw one ball out of a box (there are 10% of win balls and 90% of no win balls). After that, the ball is put back into the box (so, $p_{win}=0.1$ for all draws).
  • At the beginning, the player has three games.
  • If the player draws a win ball, they get more 3 games starting right after that winning draw (see the image describing that better below). In other words, every new draw (starting from the 4th one) will be played only if there is at least 1 winning draw in the 3 previous draws.
  • The game ends when the player draws 3 no win balls in a row.

Game rules description

I calculated the probability of playing the 4th game as $ p_4 = 1 – p_{loss}^3 = 1 – 0.9^3 = 0.271 $ (in other words, out of 1,000,000 players, only 271,000 will reach the 4th game).

Then I tried to calculate the probability of playing the 5th game as $ p_5 = (1 – p_{loss}^3) \times p_4 = (1 – 0.9^3) \times 0.271 \approx 0.0734 $ (I thought that 27.1% of those who played the 4th game will play the 5th game).

To check the correctness I made a simulation in a spreadsheet file and got the following results:

$ p_4 = 0.271 $ (the same as I previously calculated)

$ p_5 = 0.1981 $ (different from my calculations)

$ p_6 \approx 0.1252 $

Question: How to properly calculate that? Looks like conditional probability should be used, but I cannot figure out the proper way.

2

There are 2 best solutions below

1
On BEST ANSWER

The point is that most of the time that you play the fourth game, the win that gave you the fourth game also gave you the fifth game. So the conditional probability (which equals $p_5/p_4$) should be high. In fact, there's a simple argument that it must be greater than $23/30$: if you only won one of games $1,2,3$ then each is equally likely, and you automatically get game 5 in two cases, and have probability $1/10$ of getting it in the third. If you won more than one, you automatically get game 5. This same argument shows that the conditional probability of getting game $n+1$ given that you played game $n$ is more than $23/30$ for any $n\geq 4$.

However, it's easier to calculate exactly in this case. The only way you can play game 4 but not game 5 is if the first four results are precisely WLLL, which has probability $\frac{9^3}{10^4}=0.0729$. Thus $p_5=p_4-0.0729=0.1981$.

Similarly the only sequences which give you game 5 but not game 6 are WWLLL and LWLLL, so you can work out $p_6$ by subtracting the total probability of those.

1
On

I want to calculate an average win in a game.

The previous notations are set up to be $p_4 = P(n>=4)$ which may not help calculating exact averages, you would want a PMF which would be conditional like you mentioned. Although using a simulation is also a good idea here.

We can get the average number of steps via expectation:

E(x) will be the expected number of games given we currently have 3 tries ahead of us,

$E(x) = 3*.9^2 + .1*(E(x)+1) + .9*.1*(E(x)+2) + .9^2*.1*(E(x)+3))$

$E(x) = 3.717$

An average number of wins is similar.

E(w) will be the expected number of wins given we currently have 3 tries ahead of us,

$E(w) = .1*(E(w)+1) + .9*.1*(E(w)+1) + .9^2*.1*(E(w)+1)$

$E(w) = .37$

This makes sense if our average game is 3.717 steps then we will win .37 times if we have $1/10$ chance of winning.

Simulating for 1,000 games on my end gives E(w) = .371, which seems to back up this answer.

import random

def playGame():
    wins = 0
    consecutiveLosses = 0
    
    while True:
        draw = random.random()  # Random number between 0 and 1
        
        if draw <= 0.1:  # Win ball drawn
            wins += 1
            consecutiveLosses = 0
        else:  # No win ball drawn
            consecutiveLosses += 1
        
        if consecutiveLosses == 3:  # Game ends if 3 consecutive losses
            break
    return wins

def simulateGames(numSimulations):
    totalWins = 0
    for _ in range(numSimulations):
        totalWins += playGame()
    averageWins = totalWins / numSimulations
    return averageWins

numSimulations = 100000
averageWins = simulateGames(numSimulations)
print(f"Average wins after {numSimulations} simulations: {averageWins}")