We�re going to assume the player is a smart player, and at each decision point makes the smartest possible re-roll and hold choices. The probability of getting a Yahtzee in a single roll is easy to calculate. There are five dice, so whatever the first die rolls there is a 1/6 chance that the second die is the same number. If that occurs, there�s a 1/6 chance that the third die is the same, ditto the fourth and the fifth. So probability of Yahztee in one roll is 1/6 x 1/6 x 1/6 x 1/6 = 1/1296. With three rolls and holding, however, things get a little more complicated. The number of dice we roll each turn can be changed, and there are many possible combinations to consider. Because the state of dice at the start of each roll is independent of how the dice were rolled, this is a perfect chance to roll out one of my favorite tools, the Markov Chain (for more background on this, see my earlier postings on CandyLand, and Chutes and Ladders).
This is the trivial case. There are only two patterns for the way that two dice can be rolled. They either match, or they do not. There is a 1/6 chance that the second of the two dice will match the first, and conversely, there is a 5/6 chance that it will not match. The probabilities, of course, have to add up to 1 (one of the two events must occur). Another way to look at this is that there are 36 possible combinations for two dice to be rolled. In six of these combinations {1.1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6} the numbers are the same, and in 30 of these combinations, the dice are different. These results are show graphically on the image above. There is a 6/36 chance that both dice will be the same, represented as {A,A}, and 30/36 chance they will be different, represented as {A,B} This gets a little more complex, but not much. Here there are three possible flavors of result for the three dice: They are either all the same, they are all different, or there will be two of one number and one of another. There are 216 possible ways that three dice can be rolled (6 x 6 x 6). We can calculate the probability of them all being the same, easily, as 1/6 x 1/6 = 1/36 (The second die matches the first 1 time in 6, and the third die matches, again, 1 time in 6). Alternatively, we can imagine that, of the 216 possible ways the dice could land, there are six possible ways when they are all the same: {1,1,1}, {2,2,2}, {3,3,3}, {4,4,4}, {5,5,5}, {6,6,6}. The probability of them all be being different can be calculated using the following logic: The first die can be whatever it likes, then for the second die there is a 5/6 chance that it will not be the same number as the first die. Finally, there is a 4/6 chance that the third die will be different for the first two. So, the probability that all the dice will be different is 5/6 x 4/6 = 20/36 which can be unsimplified to 120/216. There are 120 possible combinations of the 216 possible outcomes where all three dice are different {A,B,C}. Because we know that total of all probabilities for the way three dice roll must add up to 1.0 we can deduce that the probability of two of the dice being the same {A,A,B} is 90/216 (Which is 1 � 6/216 � 120/216). (If you want to convince yourself of this, think of it this way: There are six possible values that A could be, five possible values of what B could be, and three possible choices of which die could be B. This is 6 x 5 x 3 = 90 combinations out of the 216). Things are starting to get a little more complex now. They can be all the same, all different, three of a kind, two lots of two pairs, or a pair with two different singletons. There are 1296 ways that four dice can be arranged (6 x 6 x 6 x 6). The results are shown below: We need to be extra careful here, because we don�t want to double count. When counting the two lots of two pairs, we need to make sure that we don�t inadvertently count {5,5,5,5} as two sets of double five and place this in the {A,A,B,B} bucket, because it is really four of a kind and needs to be in the {A,A,A,A} bucket. If we double count, the probabilities will become greater than 1.0! Deriving the above table can be done in a variety of ways. Those of you who studied math at university might reach for a binomial expansion for calculating the permutations. Alternatively, like we discussed in the Risk analysis page, the number of combinations is so small (just 1296) that you might want to simply brute-force all the combinations in code and count them. It�s actually a good mental exercise to work through derivation of these numbers to convince yourself that the numbers are correct. For instance {A,A,A,A} is 1/6 x 1/6 x 1/6 for the chances that the second, third and four die match the first. (Alternative thinking, is that there are only six ways to get four of a kind = 6/1296). For three of a kind {A,A,A,B} there are six possible numbers that A could be, and five possible numbers that B could be, and four locations for the dice B, which is 6 x 5 x 4 combinations = 120/1296. For all the dice to be different {A,B,C,D} there is a 5/6 chance that the second dice is different from the first, and a 4/6 that the third is unique, and 3/6 chance that fourth is. 5/6 x 4/6 x 3/6 = 60/216 = 360/1296. Interesting Note � As an aside here, when rolling four dice, the most likely outcome is that you will get a pair, and there is a greater than 72.2% chance that you will get a least a pair (720+90+120+6)/1296 Now things are getting a little busy! There are 7776 possible combinations for five dice. The results are shown below. In the interests of brevity, I�m not going to derive them all here (maybe in a future blog post), and I�ll simply show the results so we can get back to the Markov Chain. Interesting Note � The probability of rolling a FullHouse in one roll is 300/7776 cf. Four of a kind at just 150/7776. According to our rules, a full house scores 25 points and (at most), the four of a kind can score 30 points (all sixes � Yahtzee bonus excluded), so the full house is an easy point pickup, being twice as easy as getting as four of a kind! Interesting Note � With five dice, there is 7056/7776 chance that you will get a pair or better on your first roll (90.7%) Back to MarkovTo perform our Markov analysis, we need to create a Transition Matrix which defines the probability of moving between each state. As the states, I�m going to select the number of matching dice in the set, so we have 5 states: 1,2,3,4,5 (Here, "1" matching dice could also be described as a singleton). This results in a matrix of 25 elements.
To complete the coefficient of transition from a pair (state 2) to stay as a pair (state 2), we need the basic probability of this, which is simply 5/6 x 5/6 x 5/6 (all three dice miss matching the pair), and from this, we need to subtract the chance that all these three dice are the same and do not form a Yahtzee (5/216), so the final result for this element = 125/216 � 5/216 = 120/216. Similarly, the inverse of this trick for the transition probability from a pair state 2 to three of a kind state 3. Here basic probability of moving from state 2 to state 3 is 75/216 (three dice are rolled, with 1/6 chance of a match, then two 5/6 chances of a miss, and there are three combinations of ways this can be achieved which is 3 x 1/6 x 5/6 x 5/6). To this basic probability of 75/216, we need to add the 5/216 chance from above that we got to three of a kind through this alternate route. Thus, the final element required to complete our Transition Matrix from state 2 to state 3 is 75/216 + 5/216 = 80/216. It�s also a relief to calculate that the probabilities in this row total 1.0! (120/216 + 80/216 + 15/216 + 1/216). This helps confirm our calculations are correct. Our Transition Matrix is now complete! Matrix MultiplicationWe now input an identity column vector and multiply this by the Transition Matrix. The resultant row vector output shows the probabilities of the distrubutution of states that the dice could be in. We can now take this output and use it at as the input again and this time the output is the superposition of the probabilities for the dice at the end of the second roll. To get the probability of obtaining a Yahtzee on (or before) three rolls, we multiple one last time and read the result of the firth element (state 5) in the final output vector. (From this point out, I'm switching to decimals/percentages to represent the probabilities because the fractions involved are too ungainly to enter and read). ResultsThe probability of getting a Yahtzee is 4.6029% Pretty GraphsIf you missed your Yahtzee roll, what happens if you rolled again? (as my kids sometimes try to do!) And again? And again? … Below is a chart showing the percentage chance of getting a Yahtzee in n-rolls. The x-axis is the number of rolls, and the y-axis shows the percentage chance. The curve asymptotes to 100%, and crosses over 50% by roll #10. To be 95% confident of rolling a Yahtzee you need 23 rolls.
Individual ChartsHere is the same data, but each curve plotted on it's own axis. On the first roll, it's most likely you'll get a pair, but after that the chances of end up with just a pair rapidly decreases. (You'd have to be incredibly unlucky). You can find a complete list of all the articles here. |