# A dice game, what is the optimal strategy?

Alice was walking on the street when she came across a man playing with a die. She could not help trying to check if the die was loaded and while she was concluding that it wasn't loaded, the man noticed her and started talking:

Hey madam, wanna play a game? It's simple, in a round you roll the die any number of times, add the results, and I give you the amount of money you scored. But I need to get some interest in that too, so you give me 10 for each round and if your sum is over 13, I give you nothing back. Wanna give a try?

Do you think Alice should play this game? What is the optimal strategy that she can use?
Answer is a strategy and its average score. Of course, as you brain is not as sharp as Alice's you can use computers to help you.

EDIT: A round is a succession of any number of dice roll until Alice decides to stop or is strictly over 13. Source: diophante.fr

• "Dice" is plural; singular is "die". How many dice are involved here, and what counts as a try? – Jeff Zeitlin Jul 2 '18 at 12:26
• There is only one die sorry. a try is a sequence of die throw a until she decide to stop or reach 14 or more. – Untitpoi Jul 2 '18 at 12:28
• Pretty sure you pay 10 for each roll and when you stop you get the total you rolled. (Sounds like a horrible idea to me, pay 10 get at most 6 back, pay 20 get at most 12...) Unless he means 10 per set of rolls, that would make more sense – dcfyj Jul 2 '18 at 12:39
• @SilverCookies You will loose 10, yes. You don't pay for each roll, you pay for each "sequence" of rolls. – Untitpoi Jul 2 '18 at 12:42
• @Untitpoi, my apologies if this has been asked and answered before -- do you have the permission of the people at diophante.fr to post their questions here? And are you affiliated with diophante.fr yourself? Thanks! – Gareth McCaughan Jul 2 '18 at 12:50

Strategy:

When the current sum is 7 or less, rolling again gives us an expected gain of $\frac{1+2+3+4+5+6}{6} = \frac{21}{6}$
When the current sum is 8, rolling again gives us an expected gain of $\frac{1+2+3+4+5-8}{6} = \frac{7}{6}$
When the current sum is 9, rolling again gives us an expected gain of $\frac{1+2+3+4-9-9}{6} = \frac{-8}{6}$

So our strategy should be to continue rolling until we reach a 9 or higher.

Expectated gain:

With this strategy our chances are as follows:
When our current sum is 8 or less we have a $1$ in $6$ chance to advance to each of the next 6 numbers. When our current sum is 9 or more, we stop and thus always stay at our current sum. To calculate our expected gain we put those values into a matrix $A$ (The number in row $r$ and column $c$ representing the chance that we will reach the sum $c$ after one roll when we started at sum $r$.) and multiply it by itself until we have $A^9$ (After 9 throws we will always reach a 9 or higher). The first row then tells us the probability of each sum (The number in column $c$ represents the chance that we will reach the sum $c$ after 9 throws (or less if we stopped).):

9: $\frac{2825473}{10077696}$
10: $\frac{2444449}{10077696}$
11: $\frac{1999921}{10077696}$
12: $\frac{1481305}{10077696}$
13: $\frac{ 876253}{10077696}$
14: $\frac{ 450295}{10077696}$

This gives our expected gain:

$\frac{2825473 \times -1 + 2444449 \times 0 + 1999921 \times 1 + 1481305 \times 2 + 876253 \times 3 + 450295 \times -10}{10077696} = \frac{262867}{10077696} \approx 0.026$

Conclusion:

Alice should probably not play this game unless her time is worth less than 0.026 currency units.

• @elias: Thanks, fixed, should obviously be 6^9. – w l Jul 2 '18 at 14:26
• The gain when the sum is 8 is wrong. It should be 7/6 – Kruga Jul 2 '18 at 14:30
• @Kruga Thanks, proofreading is clearly not a skill of mine. It is still the last positive value and is only used in the strategy part, so all the other numbers stay valid. – w l Jul 2 '18 at 14:33

Suppose Alice is somewhere in the middle of the game and trying to decide whether to roll again or not. If she is on 13, staying put wins +3 and rolling always loses 10; obviously she stays. If she is on 12, staying put wins +2 and rolling on average gets 1/6(3-5*10); obviously she stays. On 11, staying gets +1 and rolling gets 1/6(3+2-4*10), still clearly a loss.

If we continue this process backwards, then by my calculations

she should roll again if and only if her current total is 8 or less; her expected outcome is positive if and only if she is on 7, 11, 12, or 13, is zero if she's on 10, and otherwise is negative; in particular, at the outset she's on zero and expects to lose about 0.12 Currency Units by playing.

[EDITED to add:] It turns out I made a typo when doing the calculations. The actual result is that

she should still roll again if and only if the total is 8 or less; but the expected outcome is actually positive for totals of 0,1,5,6,7,11,12,13; zero for 10; and negative for 2,3,4,8,9. So Alice, if she doesn't suffer from loss-aversion as most of us do, should choose to play and will win about 0.0261 on average for each game she plays.

• I think the method is correct, but I'm afraid your numbers are flawed. I doublechecked and got the same result of ~0.026 which @wl got in his answer with a different method. – elias Jul 2 '18 at 13:52
• Very likely. I am extremely skilled in the making of careless errors, as a result of long practice. – Gareth McCaughan Jul 2 '18 at 16:21
• "Suffer from loss-aversion" is an interesting way to put it. Not optimizing the EV of your bankroll but the EV of a concave utility function (often the logarithm) of the bankroll is a very common and well-founded strategy, and that implies loss-aversion. It would actually be interesting to see how much big a bankroll you'd need for this game to be profitable in log-EV! – JiK Jul 3 '18 at 10:14
• It turns out that that implies much much much less loss-aversion than actual human beings exhibit: there's a nice paper whose title and author I forget that gives a bunch of results of the form "if you prefer X to Y just because of diminishing marginal utility, then you must also prefer A to B", where preferring X to Y is extremely normal and preferring A to B is very much less so. – Gareth McCaughan Jul 3 '18 at 10:44

Actually Alice should

play the game for sure!

Because

She will make a little money in the long term if she stops playing the game every time she gets more than $8$.

Programming Solution is here. So at the end

Alice wins!

Probability explanation is already done by w l.

Alice can play this game, with each try being a maximum of three rolls, and expect to win on average about 50 cents per try. The average roll of one die is 3.5, so in three rolls, the average sum will be 10.5. Since she is paying 10 per try, she can expect a small profit over time.

If she goes to four rolls, the average jumps to 14; at that point, she can expect on average to lose.

• Don't forget that if Alice rolls two 6 she can decide to stop. She doesn't have to stick to a predetermined number of roll. – Untitpoi Jul 2 '18 at 12:47
• Which is why I said a maximum of three rolls. If she rolls very low, she can go beyond three rolls, but you figure on the basis of the average. – Jeff Zeitlin Jul 2 '18 at 12:48
• ah missed with 15 mins! congrats for average gain calculation! – Emre Ünsal Jul 2 '18 at 13:00
• Pretty sure this is incorrect because some of the time she will "bust" by reaching a total > 13 and scoring zero. – Gareth McCaughan Jul 2 '18 at 13:01
• But the average roll isn't important. The average score is important, but because the score is a nonlinear function of the roll (because of the >13 thing) you can't compute the average score from the average roll. – Gareth McCaughan Jul 2 '18 at 13:30