How to solve a complex statistics problem with a script?
November 30, 2012 6:26 PM Subscribe
In this game, you roll a number of six-sided dice to get a total
. The total is either the highest single die result, or the sum of any multiples rolled, whichever is higher.
For example: If I roll three dice and get a 3, 4, and 6, my total is 6. But if I roll a 4, 4, and 6, my total is 8, the sum of the two 4s.
What I want to find out is the mean, median, mode, and standard deviation of the possible totals given N dice. How might I create a simple script to compute this?
posted by j0hnpaul to Computers & Internet (24 answers total) 2 users marked this as a favorite
With two or three dice, I can easily figure this out by listing all the possible results, basically by brute force. But that's a pretty labor-intensive method when it comes to four or more dice.
I have a Macintosh, and I'm comfortable using the Unix command line and several programming languages for simple problems, but I'm not even sure where to start automating something like this. I'd be grateful for any guidance.