Saturday, 22 April 2017

Next post ...

I am currently writing a post about distance modifiers (i.e. modifying the die roll in function of distance when resolving ranged combat), and how these can be turned in another mechanic, that does away with distance modifiers, but rather alters the distance at which a shot is succesful.

Any preliminary thoughts welcome ...

Tuesday, 4 April 2017

Scoring at least one success ...

The "Buckets of Dice" blogpost dealt with analyzing the outcomes of the “buckets of dice” procedure, and explained the binomial distribution for computing the probabilities of scoring a specific number of successes.

This blogpost will focus on scoring at least 1 success. It is a question that pops up often on game design boards, and is actually quite easy to compute once you know the base probability for a single success on a single die.

We will explain 2 methods for computing these probabilities, both mathematically equivalent. The first will use some basic rules from probability theory, the second will use the binomial distribution we explained before. We will explain everything in the context of rolling a number of D6. We could also provide a more general explanation of probability theory, but since this is a game design blog, we will use gaming terminology that is familiar to everyone. Hence, we will limit all examples to rolling D6’s, but it should be fairly straightforward to extrapolate to other types of dice or randomizers.

But first, let's introduce some notations, which we will use as shorthands:
  • prob(D6 = 4): the probability of rolling a 4 on a single die. As everyone probably knows, the probability of rolling exactly a pre-determined on a D6 equals 1/6
  • prob(D6 = 4+): the probability a single die will produce a result of 4 or more. Similarly, we will write prob(D6 = 2+) or prob(D6 = 3-) and so on …
  • We will also discuss rolling two dice together. To avoid confusion by numbering dice, we will identify dice by colour. So, when we roll 2 dice, one die is red, the other is blue. prob(red D6 = 6, blue D6 = 4+) is then the probability of rolling a 6 on the red die, and a 4+ on the blue die. We might even write prob(red D6 = 6, blue D6 = 4, green D6 = 3-) etc.
  • Probabilities can be expressed as numbers ranging from 0 to 1, or as a percentage.

 

Basic rules for working with probabilities


To compute the probability for “scoring at least 1 success”, one needs to know two basic rules about how to manipulate probabilities.

Rule 1: The probability of a die coming up with a range of results, equals the sum of the probabilities of the individual results.

E.g. if you want to compute prob(D6 = 4+), you simply add prob(D6 = 4) + prob(D6 = 5) + prob(D6 = 6) = 1/6 + 1/6 + 1/6 = ½ = 50%.

This rule provides us with something that is very useful: The sum of the individual probabilities of an event happening and an event not happening must be equal to 1. Or, to give a few examples in the context of a single D6:
  • prob(D6 = 4+) + prob(D6 = 3-) = 1
  • prob(D6 = 6) + prob (D6 = 5-) = 1
This makes it easy to compute probabilities by expressing them as the negative result on a die roll. E.g. if you know the probability for rolling a 4 is 1/6, then the probability for NOT rolling a 4 equals 1-1/6 = 5/6. This might seem rather trivial, but you can also use this reasoning for computing the probability for more complex outcomes, as we shall see later. There is one pitfall though, and that is that you have to be sure that the event happening and the event NOT happening cover all possible outcomes, and do not overlap with each other. Luckily, this is the case when rolling dice. Either the die produces a 4, or it does not produce a 4. There is no third option, and there is also not the possibility that the die produces both a 4 and “not a 4”.

Rule 2: The combined probability of a red die rolling some result, AND a blue die rolling  some other result, equals the product of both individual probabilities.

A few examples:
  • prob(red D6 = 6, blue D6 = 4+) = 1/6*1/2 = 1/12 = 8.33%.
  • prob (red D6 =3, blue D6 = 4) = 1/6*1/6 = 1/36 = 2.78%.
Or even:
  • prob(red D6 = 6, blue D6 = 2+, green D6 = 5+) = 1/6*5/6*1/3 = 5/108 = 4.63%
Now, there is one caveat: the results on the dice should be rolled independently from each other. But not to worry, this is the case when rolling multiple dice together, and the roll of the red die does not influence the result of the blue die and vice versa. Actually, whether you roll the dice simultaneously, or one after the other, doesn’t matter. Each die rolls its own result independently, without being aware of the outcome of the other dice.

A common mistake when using this rules is that the total number of outcomes is misjudged when trying to compute probabilities in this manner. E.g. suppose I want to know the probability of rolling a 3 and a 4 on two dice – but it does not matter what die rolls a 3 and what die rolls a 4. One might think this equals prob(red D6 = 3, blue D6= 4), but this merely expresses the probability of rolling a 3 on the red die, and 4 on the blue die. It excludes the possibility of rolling a 4 on the red die, and a 3 on the blue die, which would also be a valid outcome. Hence, the chances for rolling a 3 and a 4 on two dice (in any order), equals prob(red D6 = 3, blue D6 = 4) + prob(red D6 = 4, blue D6 = 3) = 1/6*1/6 + 1/6*1/6 = 5.56%.

Scoring at least 1 success, method 1


Let’s now take a look at the question of scoring at least 1 success on a number of dice. For the sake of clarity, let’s assume a success is rolling a 6, and let us assume we roll 4 dice. First, we use rule 1 as follows: the probability of rolling no 6’s, plus the probability of scoring at least one 6, equals 1. We can write this down as: prob(no 6’s) + prob (at least one 6) = 1. Either we score no 6’s at all, or we score at least 1. There is no other option. Hence, we can say that:

prob(at least one 6) = 1 – prob (no 6’s).

The only thing left to do is to compute the probability of scoring no 6’s, on 4 dice. The probability of rolling no 6 on a single dice is 1 – prob(D6 = 6) = 5/6 (rule 1). So, the probability of rolling no 6’s, on 4 dice, equals 5/6*5/6*5/6*5/6 = 0.48 (rule 2).

Completing the computation, we get: prob (at least one 6) = 1 – 0.48 = 0.52 = 52%.

That’s great, but what’s the general formula? If we roll n number of dice, and each die scores a success with probability s, then the probability for scoring at least 1 success equals:

prob (at least 1 success) = 1 – (1-s)^n 


with the ^ sign indicating taking (1-s) to the power n.

Scoring at least 1 success, method 2


Some readers might have noticed there must be some connection to the binomial function. After all, in the "Buckets of Dice" blogpost, we expressed Bin(k, n, s) as a function of 3 variables: k is the number of successful events out of a total of n events, and s is the probability of a single event (in our case a die roll) being successful.

So, Bin(0, n, s) is the probability of 0 successful events. The probability for at  least 1 successful event can then be computed as 1- Bin(0, n, s). And lo and behold, when you do the math, this works out exactly the same as the formula above.

Alternatively, you can add up the chances for 1 success, 2 success, up to n successes: Bin(1,n,s) + Bin(2,n,s) + … + Bin(n,n,s), since all these together are all possible outcomes for scoring at least one success. This is a little bit more difficult to work out mathematically, but the result is the same.

Results


Now that we know how to compute the probability, let’s look at some results.
The table below lists the probability for scoring at least 1 success, when rolling 1-12 dice, and for various target numbers that signify success.

6
5+
4+
3+
2+
1
0.17
0.33
0.50
0.67
0.83
2
0.31
0.56
0.75
0.89
0.97
3
0.42
0.70
0.88
0.96
1.00
4
0.52
0.80
0.94
0.99
1.00
5
0.60
0.87
0.97
1.00
1.00
6
0.67
0.91
0.98
1.00
1.00
7
0.72
0.94
0.99
1.00
1.00
8
0.77
0.96
1.00
1.00
1.00
9
0.81
0.97
1.00
1.00
1.00
10
0.84
0.98
1.00
1.00
1.00
11
0.87
0.99
1.00
1.00
1.00
12
0.89
0.99
1.00
1.00
1.00

You can easily read results from this table. E.g. when rolling 5 dice, with a 4+ needed for success, there is a 97% chance of scoring at least 1 success. Note that the results are rounded to 2 significant digits, so a result of 1.00 (100%) is not a 100%, but it is at least 99.5%.

Just to illustrate things, below is the table for rolling 12 dice, with probability for success on a single die expressed in 10% increments. Think about this as rolling a number of D10’s, in an analogue manner as we derived the results for a number of D6’s. So, when rolling 4 D10’s, each with a target number of 7+ (40% chance for success), there is a 87% chance of scoring at least 1 success.

0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90
2
0.19
0.36
0.51
0.64
0.75
0.84
0.91
0.96
0.99
3
0.27
0.49
0.66
0.78
0.88
0.94
0.97
0.99
1.00
4
0.34
0.59
0.76
0.87
0.94
0.97
0.99
1.00
1.00
5
0.41
0.67
0.83
0.92
0.97
0.99
1.00
1.00
1.00
6
0.47
0.74
0.88
0.95
0.98
1.00
1.00
1.00
1.00
7
0.52
0.79
0.92
0.97
0.99
1.00
1.00
1.00
1.00
8
0.57
0.83
0.94
0.98
1.00
1.00
1.00
1.00
1.00
9
0.61
0.87
0.96
0.99
1.00
1.00
1.00
1.00
1.00
10
0.65
0.89
0.97
0.99
1.00
1.00
1.00
1.00
1.00
11
0.69
0.91
0.98
1.00
1.00
1.00
1.00
1.00
1.00
12
0.72
0.93
0.99
1.00
1.00
1.00
1.00
1.00
1.00

 

How to use as a gaming procedure?


A dice rolling procedure is meaningless by itself. It always needs to be embedded in a bigger framework of rules, and it should be given meaning within the context of a game.

Nevertheless, there are some interesting observations one can make from the tables above. If a specific mechanic only distinguishes between scoring no successes, and at least one success (in other words, no distinction is made whether you score multiple successes), it is obvious you should keep the number of dice, as well as the chance for success on a single die roll, both low. It makes no sense to design a mechanic in which you roll 6 D6’s, and have to score at least one success as a 4+. That gives you a probability of 98%, so why bother? On the other hand, rolling 3 D6’s, and requiring a 5+, gives a probability of 70%. That is still high, but at least it might make sense within a specific gaming engine.

Due to the limited “working range” of the “at least one success” mechanic, it is also a bit difficult to analyze possible modifiers. Either you could alter the target number (shifting a column left or right), or alter the number of dice (shifting a row up or down). There is no easy equivalency to be detected. This is partly caused by the power-dependency of the probability (mathematically, we would want to compute the derivative function, which is non-linear in this case). But if you want to introduce modifiers, use only one of them. It’s always a bad idea to modify target numbers and numbers of dice within the same die roll, since that simply confuses players and makes it harder to remember the rules

Personally, I am not a big fan of the "score at least one success" procedure, because it is a very binary decision to use as a resolution mechanic. But it is always nice to be able to compute the various probabilities, even if you would differentiate between 1, 2, 3, ... successes after the roll. And as a games designer, it's always useful to have a variety of tools in your toolbox, even though you rarely use some of them ...