# Optimal Strategy in 3 Dice Game

In a recent interview I received the following question (an optimisation/strategy game)...which left me a bit stumped. The rules of play, you start with 0 points, then:

• Roll three fair six-sided dice;

Now you have the option:

• Stick, i.e. accept the values shown on your dice as the score for your turn. There is a caveat, if two or more dice show the same values, then all of them are flipped upside down - e.g. 1 becomes 6

OR

• reroll the dice. You may choose to hold any combination of the dice on the current value shown (so you can choose to keep 1 dice the same and then reroll the other two). Rerolling costs you 1 point – so during the game and perhaps even at the end your score may be negative.

You can roll an infinite number of times...

My thoughts:

• So clearly the best possible score is 18 and is achieved by rolling three 1s on the first roll
• The reroll penalty prevents rolling forever to get 18.
• If the value of the dice is greater than the expected value of rerolling them (accounting for the penalty), then you should stick...

I guess what I am asking is how do I work out the expected value of rerolling them (accounting for the penalty) and how does this fit into the optimal strategy...

Thanks for all help in advance.

========================================================================

.

• Nice puzzle, just to confirm: say the first throw is $(1, 2, 3)$ and I decide to rethrow the 1. What happens if I throw 2? Will the 2 already thrown also flip to get $(6, 6, 3)$? – Bob Jansen Jan 27 at 17:17
• So if you rethrow the dice with value 2 (I assume you are thinking in terms of a array 0,1,2 counting in your comment) and get a 1, then the result would be (6,6,6) equalling 18, but as you rerolled the result would be 17 (rules state is two or more are the same all get flipped). thanks – bob Jan 27 at 17:27
• Sorry messed up my initial comment – Bob Jansen Jan 27 at 17:38
• I’m voting to close this question because its not about quant finance. Just because it was asked in an interview doesn’t make it on topic. – LocalVolatility Jan 27 at 21:02
• How about moving the question here and making it one post with the answer below? – Jan Stuller Jan 28 at 10:16

I agree this is off topic so let me try to reign it in with general response.

A common solution to financial and probabilistic problems is to reduce them to explore more simpler cases, from which you may be able to deduct patterns.

1. Consider only one die

If you only had one die the flipping is irrelevant. The solution is to keep your score provided it is greater than the expectation which is: (3.5 - rolls + 1). I.e. you roll a 4 on first roll: you keep it. You roll a 3 on second roll, you keep it.

1. Consider two dice

Suppose now the dice only had two sides {1,2}. Then you have 4 possible outcomes:

• (1,1): score 4 - do not reroll.
• (1,2): score of 3 - do not reroll.
• (2,1): symmetric with above
• (2,2): score of 2. Optimal to reroll just 1 die: 50% score increases to 3, 50% score remains at 2.

The expectation of this game is

What if the the dice had sides {1,2,3}:

• (1,1): score of 6 - do not reroll.
• (1,2): score of 3 - reroll the 2: 33% score increase to 5, 33% reduce to 2, 33% stays at 3, i.e expectation gain of 0.333.
• (1,3): score of 4 - do not reroll.
• (2,1): symmetric with above.
• (2,2): score of 4 - do not reroll.
• (2,3): score of 5 - do not reroll.
• (3,1): symmetric with above.
• (3,2): symmetric with above.
• (3,3): score of 2 - reroll 1 die: 3% score increase to 5, 33% stays at 2, 33% increase to 3, i.e. expectation gain of 1.33

=============

Another way to approach your problem is to think from another perspective. Suppose your target was to achieve the maximum 18 points, how many rolls would this take on average?

• Your answer is not sensible as you fail to take into account the value of the option to continue after each toss. To illustrate this imagine the case with one die and a very small rolling penalty. Here you will clearly continue rolling until you achieve a 6, no matter how long it takes. – JamesG95 Jan 28 at 14:20
• Hi: you need to write the expectation as a function of itself and then you can can solve for it. I don't have time to try it but this link should give some idea of what I'm referring to. The problem involves shooting free throws so totally different but the technique would be the same. stats.stackexchange.com/questions/495990/… – mark leeds Jan 28 at 22:01
• @JamesG95 the penalty is defined as 1, so in the case it is not effective to keep rolling. I agree if the penalty were lesser you just keep rolling. – Attack68 Jan 29 at 11:02
• @markleeds I agree you need a recursive formula, i didn't quite have enough ingenuity to derive it (yet?)- I will wait for someone else to post the solution! – Attack68 Jan 29 at 11:02
• I playe around a little last night with it and got nowhere. It's not as easy as the free throw one for sure.. I would read the free throw one first and see if that makes sense and then go from there. One thing I think that I realized is that the mirror part doesn't matter. everything has equal probability so that shouldn't effect anything, atleast I don't think so. It's a more difficult problem than I originally thought. I'd like to see a solution also. You need to use the recursive nature of a markov chain but how to do that is the challenge. I'm sorry that I can't be of more help. – mark leeds Jan 29 at 17:38