# Math Help - Dungeons and Dragons

1. ## Dungeons and Dragons

To generate your stats you roll four six-sided dice, drop the lowest and add the other 3. What is the average score you would get with this process, please? and why...

Thanks,
Morlaf

2. ## Re: Dungeons and Dragons

Originally Posted by Morlaf
To generate your stats you roll four six-sided dice, drop the lowest and add the other 3. What is the average score you
I would like to know how to model this question. I do not.
I have not done any programming is years.
But I know how to do that way.
We need an array $1296\times 4$ that contains all distinct four-tuples of the set $\{1,2,3,4,5,6\}$ .
The outcomes in this question are $\{3,4,\cdots,17,18\}$.
We need to search that array row-wise dropping a least element in a row and adding the other three. That way we can count the number of ways of getting each of those 16 outcomes.
If $N=x$ for $x\in\{3,4,\cdots,17,18\}$ then we can find the probabilities.
For example $\mathcal{P}(N=3)=\frac{1}{1296}$
Again, $\mathcal{P}(N=18)=\frac{21}{1296}$.

The answer that you seek is $\sum\limits_{k =3 }^{18}{k\mathcal{P}(N=k)}$

3. ## Re: Dungeons and Dragons

Thanks for getting back to me on this one. I see where you are going with this but I must admit it has not really shed much light on my original question.
I do a bit of coding myself (a bizarre game with javascript) but only briefly touched on C++ arrays.
Any other more thorough takes on this people?

4. ## Re: Dungeons and Dragons

Here you go.

"...the calculated mean of the 4d6-L distribution is 12.24."

5. ## Re: Dungeons and Dragons

that is terrific... thanks!

6. ## Re: Dungeons and Dragons

Unless I am reading it incorrectly, the cited paper is talking about "6D4L" where they roll four six sided dice and discard the lowest number. I wrote a Java program that simulates rolling six six sided dice, then dropping the lowest and highest numbers 10000 times. I got an average of "13.975" which I would round to 14.

7. ## Re: Dungeons and Dragons

My friend says you can do this a more theoretical route using an "order statistic" (which I'm not familiar with).

I wrote a program in Scala to calculate this. This should be 100% accurate.

Basic logic:
Iterate every permutation of die values (total of 6^4 permutations)
For each permutation calculate the sum minus lowest. Increment corresponding bucket by one.
Use the permutation counts to calculate expected value.

In the results below, there are 21 permutations for a net value of 18 with a probability of 21/(6^4)=0.016.

Expected value is calculated as normal for discrete variables: (3*1 + 4*4 + 5*10 + 6*21 + ... + 18*21)/(6^4)

My end result is 12.245. This should be 100% accurate.

0: 0: 0.000
1: 0: 0.000
2: 0: 0.000
3: 1: 0.001
4: 4: 0.003
5: 10: 0.008
6: 21: 0.016
7: 38: 0.029
8: 62: 0.048
9: 91: 0.070
10: 122: 0.094
11: 148: 0.114
12: 167: 0.129
13: 172: 0.133
14: 160: 0.123
15: 131: 0.101
16: 94: 0.073
17: 54: 0.042
18: 21: 0.016
expected = 12.245

Code:
object Probability4d6l {
def main(args: Array[String]) {
val permCounts = new Array[Int](19);
val numpermutations = 6 * 6 * 6 * 6;

for (d1 <- 1 until 7) {
for (d2 <- 1 until 7) {
for (d3 <- 1 until 7) {
for (d4 <- 1 until 7) {
val lowest = math.min(d1, math.min(d2, math.min(d3, d4)));
val value = d1 + d2 + d3 + d4 - lowest;

permCounts(value) += 1;
}
}
}
}

var expected: Double = 0.0;

for (i <- 0 until permCounts.length) {
expected += i * permCounts(i).asInstanceOf[Double] / numpermutations;
println("%d: %d: %.3f".format(i, permCounts(i), permCounts(i).asInstanceOf[Double] / numpermutations));
}

println("expected = %.3f".format(expected));
}
}

8. ## Re: Dungeons and Dragons

Maybe I too am misreading the question and or paper.
Of course my first reply was a attempt at a pure counting solution.
I have now programmed a computer algebra system to do $10^6$ trials.
Dropping the lowest of the four gives me a mean of $12.246$.
That agrees more or less with that paper.

Dropping the highest of the four gives me a mean of $7.004$.

Dropping the lowest and highest of the four gives me a mean of $8.754$.

9. ## Re: Dungeons and Dragons

VinceW and Plato are right, the mean given in the paper is an approximation.

$\frac{3(1)+4(4)+5(10)+6(21)+7(38)+8(62)+9(91)+10(1 22)+11(148)+12(167)+13(172)+14(160)+15(131)+16(94) +17(54)+18(21))}{6^4}$
$15869/1296=12\frac{317}{1296}=12.2445\overline{987654320 }$