Game Designers' Resource Thread

teucer

roll
Validated User
#1
(Mods, please sticky this)

In this thread, I'd like links or explanations of all the statistical techniques or other key pointers for game designers that have come up.

I'll start with the basics of binomial distributions. Suppose you have a die which might yield a success or might not. You roll some number of these. Each one has the same probability.

If you roll n dice, and each die has a probability p of being a success, the probability of rolling exactly k successes is (p^k) * ((1 - p)^(n - k)) * nCk. nCk (read "n choose k") can be found using pascal's triangle, which looks like this:

Code:
1
1 2 1
1 3 3 1
1 4 6 4 1
Each number is the sum of the number above it and to the left and the number above it. If you find the line with n+1 numbers in it and count k of those numbers from either end, starting with zero, you have nCk. For instance, if we want 4C2, we go to the line "1 4 6 4 1" and take the third number in it. That is six.

Suppose we flip four coins and count the heads. What is the probability that we get exactly two? Since the coins are independant and each have a 50% chance of coming up heads, the answer is (.5^2) * (.5^2) * 6. This equals .25 * .25 * 6, or .375.
 

Mapache

Trickster God
Validated User
#6
teucer said:
nCk (read "n choose k") can be found using pascal's triangle
nCk is also equal to n!/(k!*(n-k)!), where ! is the factorial operator (0! = 1, and x! = x * (x-1)!). Also, the above Pascal's Triangle is missing what should be the second row, a pair of ones.
 

Zeea

Moderator
Staff member
Moderator
RPGnet Member
Validated User
#7
Harlequin, it just so happens I needed to check the sum probabilities of 3d6 today and you just saved me about 5-15 minutes of adding or programming. I am in your debt. :)
 

teucer

roll
Validated User
#8
Re: Re: Game Designers' Resource Thread

Mapache said:
nCk is also equal to n!/(k!*(n-k)!), where ! is the factorial operator (0! = 1, and x! = x * (x-1)!). Also, the above Pascal's Triangle is missing what should be the second row, a pair of ones.
Indeed, but it's too late to edit it now. Correctly:

Code:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
 

teucer

roll
Validated User
#10
If you add a large number of dice together, the probability of each result can be estimated by the formula P(x) = e^(-(x - m)^2 / 2V) / sqrt(2Vpi), where V is the variance of the die roll (the square of the standard deviation) and m is the mean result. The more dice you roll, the closer this comes to the correct value.

The cool thing about variances is that if you have two things you're rolling and add the results, you can add the variances. (This only works because die rolls are independent of one another). Therefore, if you roll NdX, the variance is N times the variance of 1dX. Here's the variance for each of the usual dice:

Code:
d4   1.6667
d6   3.5
d8   6
d10  9.1667
d12  13
d20  35
d100 841.6667
 
Top Bottom