14
2
Suppose you have two six-sided dice. Roll the pair 100 times, calculating the sum of each pair. Print out the number of times each sum occurred. If a sum was never rolled, you must include a zero or some way to identify that that particular sum was never rolled.
Example Output: [3, 3, 9, 11, 15, 15, 11, 15, 7, 8, 3]
The number of times a sum was rolled is represented in the sums index - 2
In this example, a sum of two was rolled 3 times ([2-2]), a sum of three 3 times ([3-2]), a sum of four 9 times ([4-2]), and so on. It does not matter the individual dice rolls to arrive at a sum (5 and 2 would be counted as the same sum as 6 and 1)
"Ugly" outputs are fine (loads of trailing zeros, extra output, strange ways of representing data, etc.) as long as you explain how the data should be read.
2Do you mean "print out the number of times each pair occurred" or "print out the number of times each sum occurred"? – Esolanging Fruit – 2017-05-24T05:21:43.410
what numbers are on the dice? how 15 comes up? – tsh – 2017-05-24T05:27:03.147
In the array, [3, 3, 9...], it means "2 came up 3 times, 3 came up 3 times, 4 came up 9 times..." – Steve Bennett – 2017-05-24T05:27:58.060
1If a particular sum never comes up, does there need to be a
0
in the list, or can it be omitted? – Greg Martin – 2017-05-24T05:34:12.4671Do the different values need to be consistently identifiable or do the counts alone suffice? – Jonathan Allan – 2017-05-24T05:35:08.273
@GregMartin That would be ambiguous, would it not? – ngenisis – 2017-05-24T06:10:39.977
It would. But it would also be ugly, and the spec is unclear.... – Greg Martin – 2017-05-24T06:30:43.687
1If the output is just the number of times each combination of pairs occurs, why do we need to sum the value of each roll? What are we supposed to do with that total? What do you mean by "ugly"? – Shaggy – 2017-05-24T07:09:29.607
1
extra output
but we still can't output an infinite list of random numbers and say it randomly appears somewhere in there, right? That's a standard loophole iirc. – Stephen – 2017-05-24T15:59:39.697And can we return an array of the values from a function instead of printing them? – Stephen – 2017-05-24T16:02:11.107
@StepHen The loophole about randomness wouldn't work anyway, because of the output format (Result for 2d6 = array index + 2). However, one similar but valid loophole is that you could output a list of 11 random numbers that sum up to 100, as this is a valid (yet unlikely) result of 100 dice rolls. – Nathan.Eilisha Shiraini – 2017-08-23T07:20:23.023