The game of Yahtzee is played with five sixsided dice. A "Yahtzee" is when all five dice show the same face. You begin by rolling all five dice. You are allowed two subsequent rolls in which you can roll any subset of the five dice. Assuming that your only goal is to get a Yahtzee and that you play optimally, what is the probability of succeeding?
We need the conditional transition probabilities of going from a given state of nofakind to mofakind by tossing 5 minus n dice. Two pair count as one pair (certainly on the second subsequent roll, and it's probably the best strategy on the first added roll; actually I show that it is actually the best strategy, at the end of this comment). A full house counts the same as 3ofakind.
On the initial toss, of the 7776 possible outcomes,
720 have no matches  all are different 5/54
5400 have one or two pairs (no 3 match) 25/36
1500 have three of a kind 125/648
150 have four of a kind 25/1296
6 have five of a kind 1/1296
The resulting probabilities are shown to the right.
(from
For a = 1 To 6
had(a) = had(a) + 1
For b = 1 To 6
had(b) = had(b) + 1
For c = 1 To 6
had(c) = had(c) + 1
For d = 1 To 6
had(d) = had(d) + 1
For e = 1 To 6
DoEvents
had(e) = had(e) + 1
mx = 0
ct = ct + 1
For i = 1 To 6
If had(i) > mx Then mx = had(i)
Next
nOfAKind(mx) = nOfAKind(mx) + 1
had(e) = had(e)  1
Next
had(d) = had(d)  1
Next
had(c) = had(c)  1
Next
had(b) = had(b)  1
Next
had(a) = had(a)  1
Next
For i = 1 To 5
Text1.Text = Text1.Text & Str(nOfAKind(i))
Next
)
On the first subsequent roll:
If you previously had no matches, the probabilities of going to any given state are the same as given above.
If you had one or two pairs and roll three dice, the probabilities are:
None match the value on the first pair: (5/6)^3 = 125/216 but from this we subtract the 5/216 probability they match each other, counted below, making 120/216 = 5/9 probability that the single pair won't be improved.
1 of the three matches the first pair: 3*(1/6)*(5/6)*(5/6) = 75/216 = 25/72
All three match each other but not the first pair: (5/6)*(1/6)*(1/6) = 5/216
These two combine to give the probability that the given pair will be converted into a triplet (not necessarily including the original pair): 80/216 = 10/27.
2 of the three match the first pair: 3*(1/6)*(1/6)*(5/6) = 15/216 = 5/72, so that's the probability of converting the pair to a 4ofakind.
All 3 match the first pair: (1/6)^3 = 1/216 and now you have yahtzee.
If the first roll gave you three of a kind:
Neither matches the first set: (5/6)^2 = 25/36
One matches: 2*(1/6)*(5/6) = 10/36 = 5/18 probability of advancing to 4 of a kind.
Two matches: (1/6)^2 = 1/36 of converting 3 of a kind into yahtze.
Of course four of a kind has a 1/6 probability of advancing to yahtzee. (and 5/6 of remaining four of a kind)
And yahtzee stays a yahtzee (you don't roll again).
Well now you have a matrix that you can iterate:
5/54 25/36 125/648 25/1296 1/1296
0 5/9 10/27 5/72 1/216
0 0 25/36 5/18 1/36
0 0 0 5/6 1/6
0 0 0 0 1
After the very first roll, the state matrix is of course
5/54 25/36 125/648 25/1296 1/1296
representing 1 of any kind (no matches) through 5 of a kind.
I used a TI84 Plus CE to do the matrix multiplication. It reverts to decimal if the numerator or denominator gets too large.
After the first opportunity to roll again:
25/2916 875/1944 0.4090220622 0.1196702103 .0126314586
and after the second opportunity to roll again:
0.00079382241 0.2560108977 0.4524016865 0.244764941 0.0460286425
That last number on the right, 0.0460286425, is the probability of getting yahtzee that is sought. That's about 1 in 21.7256.
Added later:
Realizing I could do the matrix multiplication in Wolfram Alpha, the state matrices after the first and second opportunities to roll again are:
(25/2916  875/1944  28625/69984  8375/69984  221/17496)
and
(125/157464  26875/104976  3419375/7558272  115625/472392  347897/7558272)
making the exact final answer 347897/7558272 ~= .046028642525699.
But let's see if we can investigate that question of whether when one has two pair after the very first roll, it might be better to roll just the one unmatched die.
As noted above, If we roll three of the dice and just leave one of the pairs untouched, the state matrix would become the following after the roll:
0 5/9 10/27 5/72 1/216
If you rolled only the lone nonmatch, there would be a 2/3 probability (same as 6/9 instead of 5/9) of remaining at having no more than a pair, and a 1/3 probability of having 3 of a kind (same as 10/30 instead of 10/27), and no probability of having 4 of a kind or yahtzee. Clearly the probabilities would have shifted in the wrong direction. QED.
Edited on August 20, 2019, 2:51 pm

Posted by Charlie
on 20190820 12:22:45 