1
$\begingroup$

There is a certain game based in a D&D mechanics in which the player throws 4 perfect dices and sums the three bigger values to obtain his score. Which is the average value to be obtained after this game was played an infinity number of times?

I made a JAVA algorithm to solve with brute force. I obtained this:

+------------------------+ |Total average: 12.244598| +------------------------+ | Sum : Occurrence       | |  1  : 0                | |  2  : 0                | |  3  : 1                | |  4  : 4                | |  5  : 10               | |  6  : 21               | |  7  : 38               | |  8  : 62               | |  9  : 91               | |  10 : 122              | |  11 : 148              | |  12 : 167              | |  13 : 172              | |  14 : 160              | |  15 : 131              | |  16 : 94               | |  17 : 54               | |  18 : 21               | +------------------------+ 

Code:

public class Test{     public static void main(String[] args) {         float sum = 0;         int[] results = new int[18];          for(int i=1;i<=6;i++)         for(int j=1;j<=6;j++)         for(int k=1;k<=6;k++)         for(int l=1;l<=6;l++){             int result = i + j + k + l -                           Math.min(i, Math.min(j, Math.min(k, l)));             sum += result;             results[result-1]++;         }          System.out.println("+------------------------+");         System.out.println("|Total average: "+sum/(6*6*6*6)+"|");         System.out.println("+------------------------+");          System.out.println("  "+"Sum : Occurrence");         for(int i=0;i

But this method of resolution is computational inelegant. Can anyone solve it without the need of calculating all items from the tree of possibilities?

Computational method idea suggested by Matthew Conroy.

  • 0
    Lucas, unfortunately, it is difficult for me to understand your question. Can you please give us a link to the question in the original language? Thank you.2012-10-31

1 Answers 1

1

By brute force, looking at all possible rolls of 4 dice ($6^4$ rolls), the sum distribution looks like this:

3 1
4 4
5 10
6 21
7 38
8 62
9 91
10 122
11 148
12 167
13 172
14 160
15 131
16 94
17 54
18 21

From this we can see that the mode is 13 (appearing $172/(6^4) \approx 13.27 \%$ of the time).

The scores 3 through 13 appear $632/6^4$ of the time (less than half the time), but the scores 3 through 14 appear $799/6^4$ of the time (more than half the time), so the median is between 13 and 14.

The mean is easily calculated from this data to be $\frac{15869}{1296} \approx 12.2445987654$.

  • 0
    Sorry. It was not my intention.2012-11-02