1. Yahtzee
The theme of this chapter is games with dice. Our first game is the classic known as Yahtzee.
2. Yahtzee scoring
In Yahtzee, five dice are rolled, and the resulting face-up values, or denominations, are observed. Scoring is based on categories that describe the denominations. For example, the category known as Yahtzee itself is when all five dice are of the same denomination. In this lesson, we will learn tools that can be used to calculate the probabilities of a few of these categories.
3. Multiplication Rule
Let's start by reviewing some basic rules of combinatorics. First, the multiplication rule states that for a collection of independent processes, the total number of possibilities is the product of each individual number of possibilities.
For example, when rolling three dice, the number of possibilities is 6 to the 3rd power, which we can calculate in R.
4. Permutations
Permutations can be thought of as the number of ways that k objects correspond to n possibilities, with each possibility being used once at most, following this formula.
When n possibilities and k objects are equal, the calculation simply becomes n factorial. Consider rolling three dice and calculating the number of ways that they can land as 2, 3 and 4.
This would be 3 factorial, and we can use the factorial function to solve it.
5. Addition Rule
The addition rule tells us that we can simply add probabilities if we want the overall probability of either of two events occurring and the events are disjoint, meaning they cannot both occur in any given trial.
For example, suppose we want to know the probability of rolling either 2, 3, 4 or 3, 4, 5 with three dice. From previous slides, we know that the number of ways to roll 2, 3, 4 is 3 factorial. So the probability of this event is 3 factorial divided by 6 cubed since there are 6 cubed total configurations. The probability of rolling 3, 4, 5 is the same. Since rolling 2, 3, 4 and 3, 4, 5 cannot occur at the same time, we add the two probabilities to get our answer.
As another example, let's find the probability of all three dice landing on the same denomination. For each denomination, there is one way to have all three dice land on it. The addition rule extends to multiple disjoint events, so for six denominations, we add one over six to the third, six times.
6. Combinations
Recall the idea of a combination.
If we want to count the number of ways to choose 2 dice out of 3, we can simply use choose 3, 2.
7. Combining rules
These concepts can be combined.
Suppose we roll 10 dice and want to count the number of ways that five will be one denomination and the other five will be another denomination.
The number of possible denominations is a permutation with n equals 6 and k equals 2 since there are 6 denominations total, and two groups of dice that will each have one distinct denomination. Following the permutation formula, we can code this as 6 factorial divided by 4 factorial.
The number of groupings is the number of ways to choose 5 out of 10, times the number of ways to choose the remaining five due to the multiplication rule. This is 10 choose 5 times 5 choose 5, although 5 choose 5 is simply 1.
To obtain the answer we then use the multiplication rule on these quantities.
8. Let's calculate it!
Now let's apply these concepts to Yahtzee!