GD:Probability
Probability is the measure of likelihood something will happen, and it's very important to take into account when designing any game, but the effects are more easily described in analog games: Dice, Card, and Board games. With that in mind, let's look at some probabilities.
Note: Here we'll be referring to dice in the following format: <number of dice>d<number of sides each dice has>. So to refer to two six-sided dice, we'll use the term "2d6". This is a common way to refer to dice, hailing from Dungeons and Dragons 1.0, and has since populated the gaming industry.
Contents |
Dice
Let's start simple: What's the probability of any given roll, when you roll 1d6?
- There are six possible rolls: 1, 2, 3, 4, 5, and 6. Since each possible roll has an equal chance of coming up (assuming we're dealing with a non-weighted d6), and there are six possible rolls, each roll has a one in six, or 1/6, probability of coming up.
Pretty easy, right? Now let's try this: What's the probability of any given roll, when you roll 2d6?
- There are now 12 possible rolls: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12. However, in this scenario, the different possible rolls don't have the same probability of coming up. This is easily demonstrable if we look at the difference between rolling a 2 and rolling a 7:
- Rolls to get a 2: 1 and 1
- Rolls to get a 7: 1 and 6, 2 and 5, 3 and 4, 4 and 3, 5 and 2, 6 and 1.
- Just by looking at the size of the list, we can see there's a much higher chance of rolling a 7 than rolling a 2. And there is: In fact, the chances of rolling a 7 (1 in 6) are 6 times higher than rolling a 2 (1 in 36). Following this same logic, we can make a chart:
- Rolls to get a 2: 1 and 1
- Rolls to get a 3: 1 and 2, 2 and 1
- Rolls to get a 4: 1 and 3, 2 and 2, 3 and 1
- Rolls to get a 5: 1 and 4, 2 and 3, 3 and 2, 4 and 1
- Rolls to get a 6: 1 and 5, 2 and 4, 3 and 3, 4 and 2, 5 and 1
- Rolls to get a 7: 1 and 6, 2 and 5, 3 and 4, 4 and 3, 5 and 2, 6 and 1.
- Rolls to get an 8: 2 and 6, 3 and 5, 4 and 4, 5 and 3, 6 and 2
- Rolls to get a 9: 3 and 6, 4 and 5, 5 and 4, 6 and 3
- Rolls to get a 10: 4 and 6, 5 and 5, 6 and 4
- Rolls to get an 11: 5 and 6, 6 and 5
- Rolls to get a 12: 6 and 6
- Huh...Look at that. If you turn your head sideways, it almost looks like a bell curve. That is, in fact, the kind of curve you get if you graph the probability of each roll with two or more dice of any sides. The highest point on the bell curve will be the midpoint, and that's where the majority of your rolls will fall.
These are the basics you'll have to know about for dice game design. Oh, one more thing: Here's a quick and dirty way of calculating the midpoint of any amount of dice (dice that all have the same number of sides):
midpoint = (((number of dice thrown) x (number of sides)) + (number of dice thrown)) / 2
- For example, if we want to calculate the average of a throw of 10d6, then we take the number of dice thrown times the number of sides each die has:
- 10 * 6 = 60
- Then we add the number of dice thrown to that quantity:
- 60 + 6 = 66
- Then we divide the result by two, yielding our midpoint:
- 66 / 2 = 33
Cards
Solving probability of cards is a more complex ordeal than with dice, but it's equally important to be able to do for your card games. In order to demonstrate problems of this nature, we'll be working with a standard playing card deck.
Standard playing card deck: Defined as 52 cards, with 13 different ranks (Ace (1), 2 - 10, Jack (11), Queen (12), and King (13)), and 4 different suits (Hearts, Diamonds, Clubs, Spades). There's one set of ranks for each suit, so we have 13 * 4 = 52.
Again, let's start simple: What is the probability of drawing a red card?
- The difficulty of this problem isn't any higher than the previous dice examples. We have 52 cards, and we know that two of the suits (Hearts and Diamonds) are red. Each suit has 13 cards each, so there's 26 cards out of 52 that are red, giving us the probability 26/52, or 1/2.
Another example: What is the probability of drawing a 5?
- Each suit has a 5, and there are four suits. There are four 5's in the deck, so our probability is 4 / 52, or 1 / 13.
Those are the basics of card probability, and they'll get you through the majority of your game development. But there's more complexities to this, and they have design application as well.
What's the probability of drawing a 9 and, without replacing the 9, drawing a 10?
- This is a three-step problem:
- The first step is simply what we've been practicing up to this point: What are the chances of drawing a 9? We already know this is 4/52 = 1/13.
- Step two is what we've been practicing, but with a twist: There are still 4 10's left in the deck, but now there are only 51 cards in the deck. This gives us the rather ugly probability of 4/51.
- Step three is to multiply the two probabilities obtained above to give us the probability of the event happening: The probability of drawing a 9, then a 10. 1/13 * 4/51 = 4/728 = 1/182. This is an "and" situation: in this case, the event is less likely to happen, and you multiply the two fractions together.
One more example: What's the probability of drawing a 7 or a Heart?
- Again, this is a three-step problem:
- Step one: What's the probability of drawing a 7? 1/13.
- Step two: What's the probability of drawing a Heart? 13/52. There's a small caveat here: We already counted one of the Hearts, the 7 of Hearts. That brings the probability down to 12/52, which reduces to 3/13.
- Step three: Now that we have both of our probabilities calculated, we add our two results together. 1/13 + 3/13 = 4/13! This is an "or" situation: in this case, the event is more likely to occur, and the fractions are added together.