As the title says, I'm trying to find the formula that calculates the average cost for a game of chance.
Here are the rules of the game -
- There is a 25% chance to win a game
- The player wants to win exactly 3 games in one day. After that he stops playing.
- There is a maximum of 10 games per day
- The player pays for each game. The cost is 5 coins per game
What is the average total amount of money the player would have to spend until he reaches a day in which he has won exactly 3 games?
At first, I thought I could use the binomial distribution formula to solve the chance of getting exactly 3 wins in a day and use the result to calculate the average cost.
$$E(X) = \binom{10}{3}0.25^{3}(0.75)^{7}$$
The result is ~ 0.2502, which means meeting our goal of exactly 3 wins approximately once every 4 games. That didn't seem right. Because the binomial distribution doesn't take into account the fact that the player stops playing after 3 wins. It assumes the player always plays 10 games every day.
Since this didn't seem like the correct answer I wrote a little python program to approximate the true answer.
The program simulates 10 million iterations with the rules above (the player has a maximum of 10 games per day, or 3 wins, whichever comes first. A game cost 5 coins and there's a 25% chance to win a game).
These were the results -
- The player will have to play an average of 18.329 games until the goal of a day with exactly 3 wins is met
- Times that by the cost of 5 coins per game gives us an average cost of 91.64 coins
The full output of the program can be seen here.
So, is there a way to get to this answer without iterating through 10 million cases? Is there a formula to calculate this?