Calculating 95% chance to lose money with a game.

74 Views Asked by At

Setup

I want to evaluate how good a given lootbox is.

A lootbox has a price. When opened, it has several different chances on an outcome.

Problem

I want to calculate how many lootboxes one would need to purchase in order to have a 95% chance to lose money.

What I tried

I will make the assumption that the expected value for a lootbox is below the price of the lootbox, so on average one would lose money (otherwise this problem would not make sense)

This could be done by brute force but if a lootbox has 10 items.. and would require 10 keys I would have to calculate 10^10 options, a bit too much. I think a solution would be something along the lines of a diagonalized matrix to a power? I'm not too sure.

One thing I do know is this value, amount of purchases for 95% chance to lose money, is independent of the expected value. Since you can have a game with 100.000 input, 99% chance to win 100.001 and 1% chance to win nothing. This would still be a 99% chance to win over 1 game, but has an expected value of below the input.

Example:

10% to win $4 
20% to win $3 
30% to win $2 
40% to win $1

We say this game costs 2.25$ to play The losing chance after 1 game is 70% After 
2 games:

16% to win $2 
24% to win $3 
25% to win $4 
20% to win $5 
10% to win $6 
4% to win $7 
1% to win $8

So here you have a 65% to lose

So I want to know how many games till a 95% losing chance

The code for this is in here: https://pastebin.com/y1wNGcHh

TL:DR Input: Lootbox price, Lootbox options (Chance + Reward) Output: Amount of lootboxes required to have a 95% to lose money.

1

There are 1 best solutions below

2
On

Your lootbox has a mean return of $2$ and a variance of $\frac {10}9$. In the normal approximation, you have $95\%$ chance to be below $1.67$ standard deviations above the mean. If you play $n$ times, the $95^{th}$ percentile return is $2n+1.67\sqrt{\frac{10n}9}$ so we want $$2.25n=2n+1.67\sqrt{\frac{10n}9}\\ \frac{.25n}{1.67}=\sqrt{\frac{10n}9}\\ n=\frac{1.67^2\cdot 10}{.25^2\cdot 9}\\ n \approx 50$$

I think you are expected to make code that will play a number of games and compute whether you have won or lost thousands of times, then hunt around for the number of games that gives the $95\%$ chance to lose.