Goal-Driven Dice-Rolling Difficulty Question

septimus, can you post your code for us to play around with?

My gut says (though I have not simulated it) that locking away 2 on the first roll may not be optimal strategy. If you just save 1 and roll 9, I think you might end up with higher expected value.

I don’t see how. It doesn’t matter which number you’re going for so it’s not like you’d give up on a five in hopes of getting a six on a later roll. So if you’re going for quantity, you should go for the pair in hand - it’s guaranteed. The best you could hope for by rolling the dice is that you’ll roll the same number again.

It’s written in C and definitely not “ready for prime-time.” As is, it would take a proficient C programmer just to test the simple strategy variation you describe. But if you send email address via PM, I’ll e-mail you source. (If I do, I’ll incorporate the strategy option you describe.)

(As to the strategy variation, at first I thought Little Nemo was right, but on reflection have come around to thinking your gut may be right. But I’m not intrigued to try right now – it’s off to be with me. :slight_smile: )

To me it’s so obvious it’s almost axiomatic.

Let’s say your ten dice are all different colors. On your first rule, you get a pair - we call this number X - on the green and yellow dice.

So your choices are do you save both the green and yellow dice or do you save just the green die and reroll the yellow die so you’ll have more rolls out of it?

Well, think about what your optimum outcome is. You want to match the dice you’ve already locked. So your optimum outcome for the yellow die is to roll an X on it in order to match the X you have on the green die. And you’ve already achieved that optimum outcome on the yellow die.

So what possible argument can be made for throwing away a guaranteed optimum result in the hope that you might replicate that exact same result on a future roll? You can’t improve the result so the only possible outcomes are you’ll get the same result or a worse result.

What you overlook is the need to lock at least one die each turn.
Assume you start with a green Ace, yellow Ace and eight unhelpful red dice.
Suppose, as you did, that you roll nine dice and the yellow die comes up, as you hope, Ace again. There’s a chance that one of the red dice comes up Ace also. If not, you’ll be exactly where you would have been after roll-1 if you’d kept both Aces, but you’ve given yourself an extra roll … and a long-shot chance of rolling six Deuces or something! With the same dice, if you’d locked the yellow Ace on roll-1, you’d now be obligated to lock a mismatching die.

There’s an 80.6% chance you’ll roll at least one Ace on your 9-dice 2nd roll in which case you’ll always be at least as happy as the other way.

This argument does NOT demonstrate that the 9-dice roll is good strategy; but it does refute that it is strictly dominated. If this still isn’t clear, assume that the next 17 outputs of a random generator are
3, 3, 4, 4, 5, 5, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1
Rolling 8-dice at 2nd turn you finish with nine Aces. Rolling 9-dice at 2nd turn you finish with ten Aces.

I did rerun my simulation and discovered (still assuming the software is bug-free :dubious: :frowning: ) that Walrus’ gut was wrong, but that’s not the same as axiomatically wrong. To test Walrus’ gut further I tested some other cases (5-sided dice instead of 6-sided, or 12 dice instead of 10). I didn’t find a confirming example, but some came very close.

BTW, the average score I reported earlier, 6.960, may have been correct for the simple stated strategy, but that simple strategy blundered by locking an arbitrary die after a miss instead of matching, where possible, a previously locked “scrap” die. When a better strategy is implemented the average score increases to 6.964.

No, I didn’t ignore the fact that you’ve got to lock in at least one die each roll. That’s part of the problem. If you had infinite rolls, you could afford to throw away the number you’ve got now on the yellow die because if you’re able to keep re-rolling, you’ll eventually roll it again. But with a maximum number of rolls in the game (due to the locking factor) you have a real chance of not re-rolling the number you got on the first roll. And having rolled that number on your first roll, it seems pretty axiomatic that keeping that number is a better than taking a chance on rolling it a second time.

Consider a more extreme case (but one that uses the same logic). Suppose on your first roll you roll red1-orange1-yellow1-green1-blue3-purple1-brown1-white6-black1-gray1.

Now here’s some possible options:

  1. Lock the red, orange, yellow, green, purple, brown, black, and gray dice. Roll the blue and white dice again.
  2. Lock the red die. Roll the orange, yellow, green, blue, purple, brown, white black, and gray dice again.
  3. Lock the blue die. Roll the red, orange, yellow, green, purple, brown, white black, and gray dice again.

I think most people would consider option 1 the best plan. If you’re trying to accumulate numbers, why throw away the numbers you’ve already accumulated?

Option 3 seems especially dumb but in terms of probability it’s the same as option 2.

As for the idea that you might roll a multiple of a different number than the one you rolled a pair of on the first roll, it is admittedly a possibility. But it’s a remote possibility (your own simulation showed that switching numbers is usually a poor strategy) and less likely to happen than the possibility that you’ll fail to re-roll your original number.

(Nitpick: We’re looking for simple examples as an aid to understanding. I’m not sure how this jumble aided.)

You give up a lot by adopting the “Walrus strategy” (OK to call it that, IamtheW? :cool:), but you do gain in some cases. I agree with you that the Walrus strategy is always inferior (or almost always so – see below). What we’re disputing is whether this is “axiomatically” so, by which I think you mean that a simple combinatorial demonstration exists to prove Walrus strictly dominated.

Did you play through the case where you start with one or two Aces; and the following throws are 3, 3, 4, 4, 5, 5, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1 ? Did you confirm what I said; that Walrus finishes with ten Aces, while we only get nine? This doesn’t mean Walrus is best strategy, just that it may turn out better in some specific cases.

Without going into detail, that counterexample is “flawed” and doesn’t exclude a more sophisticated proof of the type you seek: Walrus does worse than Nemo on many other permutations of those same 17 dice. However, weighted over all such permutations, Walrus still has the advantage with those dice. (Supposing, as usual, my simulater is bug-free.)

I wanted to confirm for myself that Walrus wasn’t always inferior, and sought such an example by varying number of dice, etc. I did so, though the example is somewhat contorted.

Suppose the usual game, but instead of ten 6-sided dice, you have fourteen 3-sided dice. Suppose moreover that there is a special rule: No Deuces may be locked on the very first roll; there are no restrictions thereafter. Yes the restriction is peculiar but, especially since it affects only the first shake and is irrelevant to the key decision, I hope you’ll agree It doesn’t affect your argument.

Suppose that your first roll is two Aces and twelve Deuces. Due to the special rule, your only choices are to play Walrus (keep 1 Ace) or Nemo (keep 2 Aces). With that start, Walrus’ average number of matches was higher than Nemo’s, as were his probabilities of 5 matches or more, 6 or more, 7 or more, 8 or more, 9 or more, 10 or more, 11 or more and, most pronouncedly, 12 or more. (Nemo is better off if trying for 13 or 14 matcches.)

So, where’s my prize? Don’t they put them in crackerjacks boxes anymore? At least a piece of cheese after this maze of simulation variants? :smiley:

I haven’t read every post here (sorry!), but it looks like no one has explicitly solved for the optimum strategy.

So, what the heck. I threw together some code to solve for the optimum strategy(*). Here’s what you get if you execute the optimimum strategy. I’ll set it running overnight with more trials. Estimated statistical uncertainties are within the last digit shown.



 2  <2x10[sup]-7[/sup]
 3  0.00065
 4  0.0225
 5  0.107
 6  0.223
 7  0.298
 8  0.236
 9  0.098
10  0.0161


For each possible locked configuration and newly rolled “free” dice, one need only calculate which of the many updated locked configurations has the highest expected value for “final score”. This lends itself naturally to recursion.
(*) …assuming utility is proportional to the final “max-same-pips” count. In principle the goal could be to try to get all ten or bust, or whatever. The optimum strategy will naturally depend on one’s utility function. Here, I’m maximizing “expected number of max-same-pips”.

Update to outcome distribution for the optimal strategy, with estimated statistical uncertainty in the last digit shown:



 2 0.00000004
 3 0.00066
 4 0.0226
 5 0.1066
 6 0.2230
 7 0.2971
 8 0.2356
 9 0.0984
10 0.0160


And, the complete strategy table:



 - - - - - -    6.974
 1 - - - - -    6.772
 1 1 - - - -    6.130
 1 1 1 - - -    5.421
 1 1 1 1 - -    4.732
 1 1 1 1 1 -    4.090
 1 1 1 1 1 1    3.517
 2 - - - - -    6.795
 2 1 - - - -    6.034
 2 1 1 - - -    5.282
 2 1 1 1 - -    4.568
 2 1 1 1 1 -    3.903
 2 1 1 1 1 1    3.324
 2 2 - - - -    5.538
 2 2 1 - - -    4.835
 2 2 1 1 - -    4.170
 2 2 1 1 1 -    3.543
 2 2 1 1 1 1    2.972
 2 2 2 - - -    4.318
 2 2 2 1 - -    3.693
 2 2 2 1 1 -    3.125
 2 2 2 1 1 1    2.500
 2 2 2 2 - -    3.203
 2 2 2 2 1 -    2.667
 2 2 2 2 1 1    2.000
 2 2 2 2 2 -    2.000
 3 - - - - -    6.893
 3 1 - - - -    6.104
 3 1 1 - - -    5.351
 3 1 1 1 - -    4.646
 3 1 1 1 1 -    4.013
 3 1 1 1 1 1    3.495
 3 2 - - - -    5.468
 3 2 1 - - -    4.773
 3 2 1 1 - -    4.126
 3 2 1 1 1 -    3.555
 3 2 1 1 1 1    3.167
 3 2 2 - - -    4.204
 3 2 2 1 - -    3.607
 3 2 2 1 1 -    3.167
 3 2 2 1 1 1    3.000
 3 2 2 2 - -    3.166
 3 2 2 2 1 -    3.000
 3 3 - - - -    5.102
 3 3 1 - - -    4.451
 3 3 1 1 - -    3.843
 3 3 1 1 1 -    3.333
 3 3 1 1 1 1    3.000
 3 3 2 - - -    3.889
 3 3 2 1 - -    3.333
 3 3 2 1 1 -    3.000
 3 3 2 2 - -    3.000
 3 3 3 - - -    3.500
 3 3 3 1 - -    3.000
 4 - - - - -    7.046
 4 1 - - - -    6.280
 4 1 1 - - -    5.577
 4 1 1 1 - -    4.970
 4 1 1 1 1 -    4.496
 4 1 1 1 1 1    4.167
 4 2 - - - -    5.613
 4 2 1 - - -    4.989
 4 2 1 1 - -    4.495
 4 2 1 1 1 -    4.167
 4 2 1 1 1 1    4.000
 4 2 2 - - -    4.495
 4 2 2 1 - -    4.166
 4 2 2 1 1 -    4.000
 4 2 2 2 - -    4.000
 4 3 - - - -    5.109
 4 3 1 - - -    4.556
 4 3 1 1 - -    4.167
 4 3 1 1 1 -    4.000
 4 3 2 - - -    4.167
 4 3 2 1 - -    4.000
 4 3 3 - - -    4.000
 4 4 - - - -    4.843
 4 4 1 - - -    4.333
 4 4 1 1 - -    4.000
 4 4 2 - - -    4.000
 5 - - - - -    7.267
 5 1 - - - -    6.569
 5 1 1 - - -    5.970
 5 1 1 1 - -    5.495
 5 1 1 1 1 -    5.167
 5 1 1 1 1 1    5.000
 5 2 - - - -    5.970
 5 2 1 - - -    5.495
 5 2 1 1 - -    5.167
 5 2 1 1 1 -    5.000
 5 2 2 - - -    5.167
 5 2 2 1 - -    5.000
 5 3 - - - -    5.495
 5 3 1 - - -    5.167
 5 3 1 1 - -    5.000
 5 3 2 - - -    5.000
 5 4 - - - -    5.167
 5 4 1 - - -    5.000
 5 5 - - - -    5.000
 6 - - - - -    7.569
 6 1 - - - -    6.970
 6 1 1 - - -    6.496
 6 1 1 1 - -    6.167
 6 1 1 1 1 -    6.000
 6 2 - - - -    6.495
 6 2 1 - - -    6.167
 6 2 1 1 - -    6.000
 6 2 2 - - -    6.000
 6 3 - - - -    6.167
 6 3 1 - - -    6.000
 6 4 - - - -    6.000
 7 - - - - -    7.970
 7 1 - - - -    7.495
 7 1 1 - - -    7.167
 7 1 1 1 - -    7.000
 7 2 - - - -    7.167
 7 2 1 - - -    7.000
 7 3 - - - -    7.000
 8 - - - - -    8.495
 8 1 - - - -    8.167
 8 1 1 - - -    8.000
 8 2 - - - -    8.000
 9 - - - - -    9.167
 9 1 - - - -    9.000
10 - - - - -   10.000


The digits on the left give the numbers of matched locked dice. So, “3 1 - - - -” represents “Three of one face and one of another face, making four total locked dice and thus six free dice left to roll”. For each locked configuration, I’m showing the expected final score if you execute the optimal strategy from that point.

To execute the optimum strategy, simply examine your roll and look at all possible new locked configurations you can put yourself in. Pick the best one.

There are some interesting things in the table. For instance, imagine you have only two matched locked dice (bad first roll!). If you whiff on the locked face on the next roll but instead roll a triplet or quadruplet or quintuplet of a different face, you’re better off sticking with your starting two plus a singleton dud than you are locking the newcomers. You would need to roll a sextuplet to make it worth switching gears.

If you have three matched locked dice, you shouldn’t switch gears unless your seven-free-dice roll comes up all matched.

There are other tidbits in the table, but I’ll just leave it for others to pick through (and to look for evidence of bugs).

Ok, let’s change it up a bit. Let’s say in the game, I’m the last player to go, and I know that I need at least 7 to win. It won’t matter if I get 6 or 5 or even 2, because they are all losers. It does not even matter if I get 7 or 8 or even 10, because they are all winners; I just have to make sure that I get at least 7.

How does this change the strategy?