0
$\begingroup$

Here is the problem:

  • A bet is known to have a win rate of 25%.
  • Upon winning, the bet pays $100.
  • Player can choose the cost of the bet.

My understanding is that the breakeven bet size would be 25% times \$100 = $25, equal to the expected value of each bet.

However, I simulated this game with a short Python script:

100M trials of simple betting game

The simulation results in a profit, even after 100 million trials. It seems to always result in a profit, I've ran the simulation many times. It appears that ~$33 is closer to the actual breakeven bet size (not shown, I just manually adjusted the bet size higher until the resulting profit converged to about zero).

What am I missing here? Am I calculating the breakeven bet size wrong or is there something wrong with the simulation?

Thanks in advance!!

$\endgroup$
  • 1
    $\begingroup$ It can help to make the code look as much like the problem description as possible. At the head of the loop, then, subtract the cost of the bet from total_value (you will want to create a constant cost_of_bet = 25 to do this clearly) to model the cost of the bet. Upon success, add win_value to total_value to model the gain from winning. You don't have to do anything when success does not occur! BTW, why do you usenp.random.normal? That's obscure and inefficient compared to np.random.ranf. $\endgroup$ – whuber Aug 19 '17 at 20:21
  • $\begingroup$ @whuber Thanks for the useful feedback. I don't have a really good reason for using np.random.normal. I found it here and thought it made sense to specify the distribution from which the randoms were being created (I compared the distributions here) $\endgroup$ – Joseph Dasenbrock Aug 20 '17 at 13:55
3
$\begingroup$

Your simulation is wrong. If the cost of placing the bet is 25, and the bet pays out 100 when you win, then the net payout is 75. Right now, you are only charging the player the cost of placing the bet when he/she loses, but not when he/she wins.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.