A dice game analyser
The problem
Design a dice game, then decide with exact probability and with simulation whether it is fair, what a player should expect to win, and how the result varies over many plays.
Requirements
- List or count the outcomes and compute the exact probability of each prize
- Compute the expected profit per play and its standard deviation
- Simulate at least 100,000 plays with a fixed seed and compare with the exact answer
- Change the price to make the game fair and show the new expected value is 0
Technologies
- Python 3
- math.comb and itertools
- The random module
- Expected value and variance
Step by step
- Write the rules of the game and list every outcome of one play.
- Compute the exact probabilities and the expected profit.
- Simulate many plays and compare the average with the exact value.
- Find the fair price and report the results in a short table.
Expected result
A report that states the game's exact odds and expected value, backed by a simulation that agrees with it.
How it is evaluated
- Exact probabilities add up to 1
- Simulation and exact answers agree within the expected error
- The fair price is computed, not guessed
- The report is clear about what each number means
Ways to improve it
- Plot how the running average settles as plays increase
- Add a second game and compare them
- Estimate the chance of being ahead after 100 plays