Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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<results.length;i++)
            System.out.println("  "+(i+1)+" : "+results[i]);        

        System.out.println("+------------------------+");
    }
}

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.

share|improve this question
    
Would help if you can paraphrase your question. We are here to help you. –  jay-sun Oct 31 '12 at 23:25
    
@LucasCleto Some of what you seek is here: math.stackexchange.com/questions/80053/top-3-of-4-dice-rolls –  Matthew Conroy Oct 31 '12 at 23:47
    
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. –  Tanner Swett Oct 31 '12 at 23:49

1 Answer 1

up vote 1 down vote accepted

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$.

share|improve this answer
    
I see Lucas has added his own, identical computations to the question, and changed the question wording. Ugh. –  Matthew Conroy Nov 1 '12 at 17:46
    
Isso foi ruim? Eu vi sua tabela e decidi fazer um algoritimo para encontra-la. Além disso a questão estava mal redigida. –  John Smith Nov 1 '12 at 22:38
    
@LucasCleto You duplicated my answer without acknowledging it. I think that is not friendly. –  Matthew Conroy Nov 1 '12 at 22:47
    
Sorry. It was not my intention. –  John Smith Nov 2 '12 at 12:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.