Simulating wealth over time while playing a biased coin toss game

Question

Suppose we have a biased coin toss game that can be played an infinite amount of times, with the following attributes:

  • The coin can return either heads or tails on a toss

  • The player wins when heads is returned

  • The coin is biased, and heads is returned with a probability of 0.6, while tails comes up with a probability of (1-0.6) = 0.4

  • If heads shows up and the player wins the turn, they will win the stake that was bet

  • (e.g. if you bet 1 dollar, you'll win 2 dollars while if you were to lose you would lose that original dollar).

Given this information:

  • Write a function that can simulate n runs of this bet, returning the average payout
  • Visualize the average payout across your simulations using a histogram
  • Revisit your initial simulation, revising your bet amount (expressed as a function of your wealth) to suggest a roughly optimal allocation
  • You can read more about deriving an optimal allocation mathematically here, but in this case just showing the sensitivity through simulation will do

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now