1
$\begingroup$

DISCLAIMER: This will be done with fake money for education purposes.

I'm working on a Dice simulation site for a school project, where you play the house and you as a player have to get a higher number on your dices. You start of with 2 and the house 1. If you want to play with 3, house gets 2 and so on. You bet a mount before you start, then you roll, then the house rolls. If you win you can add another dice up to 6 dices (house 5). Every time you add a dice, the amount of money you win is increased by a tiny, but still significant amount. You can quit whenever you want.

I've made a small simulation that plays a million games and display the amount of wins both sides manages to get and in the end calculates a win rate. Playing 2 vs 1 dice I get around a 83% win rate.

Now to my problem, if I want to calculate the amount needed to always win as the house, the odds of losing (for the player) needs to be higher than the potentialwinning:risk-amount.

I don't have any problems doing it with straight up fractions and ratios like, say you have 80% chance to win as the player, 20% that the house wins:

p = 4/5 that player wins odds for player = 4/1 = 4:1 odds for house = 1/4 = 1:4 if the potentialwinning is just slightly lower, let's say 24%, house will win the end.

But when I get a chance like 83% like in my 1m simulation, I'm completely lost as to what number I'm even looking for. Please ask me any questions if you're confused.

EDIT/CLARIFICATION: Player always has one more die than the house, and if all dices added together are higher than the houses', the player wins. If it's a draw or below, the house wins. If the player wins, he can roll again, but he has to add another die for him AND the house, thus decreasing his chance to win (since going from 2v1 to 3v2 is a small decrease) but increasing the amount (the predefined value i wanna calculate, to always make the house win marginally) he can win. Both sides roll all their new dices again and compare. He can leave with the money he's earned whenever he wants.

How do I calculate the winning amount so the house always win? I understand that the odds against the player has to be bigger than the winning:risk odds. Is this is simple as making the losing percentage a fraction, converting in to a ratio and compare it with the winning:risk odds?

Let's say I have 17% chance to lose as the player, that's a 17:83 odds which is equal to 20.48%. That means that the winning:risk just has to be a tiny bit lower to make a profit as the house right?

$\endgroup$
9
  • $\begingroup$ Stimulation ? $\endgroup$ Commented Mar 1, 2014 at 15:56
  • $\begingroup$ fixedö :) funny mistake $\endgroup$
    – Kleo
    Commented Mar 1, 2014 at 16:25
  • $\begingroup$ It is a very interesting typo ! $\endgroup$ Commented Mar 1, 2014 at 16:43
  • $\begingroup$ For two dice vs one, the player wins if the higher die is higher than the house die? What happens in ties? If I understand, only if the player wins the 2 vs 1 round, he can elect to have each side roll another die? Then the highest of each side is compared? $\endgroup$ Commented Mar 1, 2014 at 17:02
  • 1
    $\begingroup$ We can calculate the chance the house wins in the 2 vs 1 game: If the house rolls $1,2,3,4,5,6$ it wins $0,1,3,6,10,15$ times out of $36$ The total is $\frac {35}{216}\approx 16.2\%$ $\endgroup$ Commented Mar 2, 2014 at 1:48

1 Answer 1

1
$\begingroup$

We need to figure out how to calculate the probability that a player with $m$ dice beats (i.e., gets an equal or greater sum than) a player with $n$ dice. For specified $m$ and $n$, there is no difficulty, and the actual calculation can be coded in a CAS quickly.

Let $p_{m,n}$ be the probability that a player with $m$ dice rolls an equal or greater sum than a player with $n$ dice. Let $P(r,k)$ be the probability that a player with $r$ dice rolls a sum of $k$. Then $$ p_{m,n} = \sum_{i=n}^{6n} P(n,i) \sum_{j=i}^{6m} P(m,j). $$ To calculate this, we let $p = \frac{1}{6}x+\frac{1}{6}x^2 \cdots + \frac{1}{6}x^6$. Then $P(r,k)$ is the coefficient on $x^k$ in $p^r$.

Using PARI/GP, we can define p(m,n) like this:

p=1/6*sum(i=1,6,x^i)

p(m,n)=A=p^m;B=p^n;sum(i=n,6*n,polcoeff(B,i)*sum(j=i,6*m,polcoeff(A,j)))

This then yields the values \begin{align*} p(1,2) &= \frac{35}{216}\\ p(2,3) &= \frac{287}{1296}\\ p(3,4) &= \frac{7999}{31104}\\ p(4,5) &= \frac{9865}{34992}\\ p(5,6) &= \frac{54489145}{181398528} \end{align*}

So, these are the probabilities of the house winning. From these, you can work out the expected winnings, and set the payoffs to keep the house always ahead.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for the answer. I'm having a hard time implementing this in php though, probably cause I don't understand it too well. $\endgroup$
    – Kleo
    Commented Mar 2, 2014 at 4:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .