Basics of dice probabilities

26 May, 2009 at 7:32 pm (game design, linkedin, mathematics) (, , )

I’ll write a post or a few about probabilities that involve rolling dice. Those who know mathematics might be more interested in probability theory.

I will assume that all probability distributions are discrete and integer-valued. Trying to apply what I say here to continuous distributions will cause problems or require thinking.

Probability

Probability measures, or indicates, how certain it is that some event will happen (or has happened, in case of imperfect knowledge). Probability of 1 means that something is certain, while 0 means impossibility. Probability 1/2, or $\frac{1}{2}$, or 50%, or 0.5 or in Finnish notation 0,5 means that something happens half the time (if the event is repeated).

I very much prefer working with fractions as they are exact and, in my opinion, more intuitive, but many people like percents. To convert a fraction into percents simply multiply it by hundred and add the %-sign.

An important axiom of probability is that something always happens. The sum of probabilities of all the specific outcomes is 1. By this I mean that if, say, a die is rolled than it gives one and exactly one result. It doesn’t land sideways. It is not hit by a meteor or eaten by a dog.

Symmetry

Especially when playing around with dice symmetry plays an important role. Symmetric events have the same probability.

I will assume that all dice are fair; in practice they are not and it doesn’t matter. An n-sided die has n symmetric results. All of them hence have the same probability. Something must always happen, so the sum of the probabilities is 1. It follows that for an n-sided die the probability of getting any result from the set $\{ 1 , 2 , \ldots , n-1 , n \}$ is 1/n, while the probability of getting any other integer is zero.

Notation

Since writing probability all the time gets boring, I’ll use a shorthand: $P( \text{event} ) = p$, which means the probability that event happens is p. For example: $P(\text{d}8=7 ) = 1/8$ and $P(\text{d}8=-4 ) = 0$.

or, and, not

Some rules for performing calculations with probabilities are in order. First, a definition: Events are independent when knowing something about one of them gives no knowledge about the others. Dice rolls are, as far as this post is concerned, independent: I roll a d12 and get a 1. This tells me nothing about what the next result will be when I roll that d12.

Take two independent events A and B. Now $P(A \text{ and } B ) = P(A)P(B)$. For example: The probability of rolling 1, 2, 3, 4 or 5 (that is: not 6) with a six-sider is 5/6. If we roll two d6s, what is probability of both of them giving a result less than six? Since separate rolls are independent events, this probability is 5/6 times 5/6, which equals 25/36. This rule applies to any finite number of rolls. As long as they are independent, and means multiplication. The independence is not there for show only: Suppose I roll a singe d4. What is the probability of that die giving result of both 1 and 4 at the same time? Obviously, since a given die only gives one result per roll, the event is impossible and hence has probability zero. Careless use of the “and is multiplication”-rule would give 1/4 times 1/4 equals 1/16, which would be wrong.

Multiplying fractions, in case it is not clear: Supposing a, b, c and d are real numbers, b and d are not zero, then $\frac{a}{b}\text{ times } \frac{c}{d} = \frac{ac}{bd}$.

Take any event. Now $P( \text{not event} ) = 1 - P( \text{event} )$. This is a direct consequence of something always happening. Example: The probability of rolling 6 with a d6 is 1/6, from which it follows that the probability of not rolling a 6, which is the probability of rolling something else than 6, is $1 - 1/6 = 5/6$. Now we have the tools for solving one problems with some history: Roll 4d6. Should you bet on rolling at least one 6? The goal here is to determine $P( \text{at least one is 6})$. Using the law of not this problem is the same as determining the probability of none of the dice showing 6, which is same as all of them giving a result from the set $\{ 1 , 2 , 3, 4, 5 \}$. We already know this probability for a single die: It is 5/6. Since separate rolls are made, the events are independent, and hence by the law of and we can simply multiply 5/6 four times, which means raising it to the fourth power: $(5/6)^4 = (5^4)/(6^4) = 625/1296$, which is slightly less than half. By the principle of not we get that the probability of getting at least one 6 is slightly more than half and should be betted on. By symbols the calculation goes as follows: $P(\text{at least one die gives a six}) = 1-P(\text{none of the dice give a six} =$ $1-P(\text{first die is not six and } \dots \text{ and fourth die is not a six}) =$ $1- (P(\text{first die is not a six}) \times \dots \times P(\text{fourth die is not a six}))$ $= 1 - 625/1296 = 1296/1296 - 625/1296 = (1296-625)/ 1296 =$ $671/1296$, which is greater than 648/1296 = 1/2.

Take two events A and B. The probability of at least one of them happening, by which I mean P(A or B), equals the sum of their probabilities minus the probability of A and B both happening; otherwise  the “and” would be counted twice. So, for any events A and B, $P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)$. An important special case: A single d12 is rolled. What is $P(\text{d}12=7 \text{ or } 9 )$?. Since rolling 7 and 9 are clearly distinct events, the probability of both happening with single die roll is 0 (since they never happen at the same time). Hence $P(\text{d}12=7 \text{ or } 9 ) = P(\text{d}12=7) + P(\text{d}12=9) - 0 = 1/6.$ Another useful application: Roll 2d6. What is the probability that at least one of them shows a 6? This can be formulated in another way: What is the probability of first die showing a 6 or the second die showing a 6? Here the events are independent since two dice are cast. Hence, $P(\text{at least one 6}) = P(\text{first d}6=6 \text{ or second d}6=6) =$ $P(\text{first d}6=6) + P(\text{second d}6=6) - P(\text{first and second d}6=6) =$ $1/6 + 1/6 - P(\text{d}6=6)P(\text{d}6=6) = 2/6 - 1/36 = 11/36$.

More to come?

If someone finds this useful, please say so. I do not know how good I am at expository text like this and I really don’t know the skill level of my audience, if any. A topic I might handle in the future, if anyone is interested, is how to calculate the distribution of a sum of two arbitrary distributions.

I managed to land a quite demanding job, so frequent updates are somewhat unlikely, at least for some time. I’ll need to do some adjusting.

Rolling the dice: When vs. How

27 November, 2007 at 7:45 pm (game design, game mastering, rpg theory) (, , , )

Rolling dice, playing cards, betting tokens, comparing scores, dancing, RPS, whatever. Resolution in general.

Open a random rpg. There will be a section of some length on how the dice are rolled, what the result means, how character traits affect it, and so on. All absolutely essential and useful material. Sometimes there is elegence, rarely true innovation, sometimes cumbersome chart-look-ups (but I don’t like charts, so maybe there are elegant uses of them somewhere).

At least for me, when the dice are rolled is far more significant when actual gameplay is considered. If there is little to nothing in the book, I default to style mostly stolen from Burning Wheel. What follows is a listing of some”when”s of rolling the dice.

1. When the situation is dramatic or meaningful. In my mind, this is a fundamental requirement. No boring rolls, please. Boring scenes are generally not very good idea, either, but rolling dice there is adding insult to injury.
2. When there are consequences for failing. There is little point in rolling if failure means simple retries ad infinitum. This should be pretty obvious, too.
3. When two players want a different thing to happen in play. If GM want’s Bob character to escape and all players want it too, it can be argued that there is no point in rolling, and Bob’s character simply escapes (or maybe a style roll determines how impressively Bob or the GM will describe the run-away, but that is not relevant). This is far from obvious principle. I don’t use this one, for example. In my opinion, the next is better for the flow of game because it introduces more trouble.
4. When there is more than one possible outcome and all of them move the story forward. That is, if someone (usually the GM) can come up with an interesting complication in case of failure, the dice are rolled. There is no point in rolling to discover the secret door which is integral to the story, if failure means not finding it. But if failure means that before finding the door, the party is tracked down by a ferocious minotaur (because finding the door took time), suddenly the roll has no chance of screwing the game and also rewards players for being good at finding secret doors.
5. When two fictional characters are in conflict. Character may be interpreted liberally (allowing the rockslide to be a character trying to bury the hapless mountaineer) or literally. I think this is a pretty good rule of thumb, because there often are interesting consequences when two characters conflict.
6. When GM (or nobody) knows or has a stake in what will happen next. Basically, as a means to avoid unfun decisions or to move blame. I think this is a useful tool in moderation (and great way to use random encounters), but widespread use is a sign of trouble. I might be wrong. Rationale: The game may be too slow (“what do you do next?”), GM uninspired (watch for burnout), GM unprepared (learn to improvise or take a break), GM not listening to players (they are bound to have some ideas for what their characters will do next), or the game simply boring (take a longer break, start a new game, get someone else to GM).

I prefer number four. Other people have other preferences. Do know that this is a fairly imporant choice and think for yourself.