### Problem Description

Here's
a program to estimate the probability of
matched sets of dice or specified sum of dots for all dice when multiple
dice are thrown.

### Background & Techniques

A project to develop a strategy for a dice game led to this program to
understand the odds of throwing for example 3 of a kind when 6 dice are
thrown. The first (un-posted) version included analytical solutions
and used the simulated results to confirm the calculated
probabilities. The only problem is, I realized that I'm not a good
enough mathematician to to figure the analytical results. So this
version only shows probabilities determined by simulating 1,000,000 trials
at a time and counting outcomes. (By definition, the
probability of a random event is the number of successful outcomes of the
event divided by the total number of possible outcomes.) Perhaps
some kind viewer will help me out and allow this page (and program) to be
completed.

Calculating the theoretical probability of throwing a pair when 3 dice are rolled seems
straightforward. There are 3 ways to throw a specific value (say 1)
. (11x, 1x1, x11). So there are 18 ways for a pair with any value to
occur (6x3). And, for each of these, the other die may be one of the
5 unused numbers so there are 18x5 or 90 successful outcomes out of the
216 possible outcomes (6X6X6). So the probability of throwing a pair
when 3 dice are thrown is 90/216 or 0.417.

Now try the same analysis for rolling exactly three matching dice when
6 are rolled. The ways to select the triplet is easy, it's 6 times
the number of ways to select 3 of 6 items which is
Combo(6,3)=6!/(3!*3!)=6x5x4x3x2/(3x2x3x2)=20. Therefore there should be 6x20 pr
120 ways to select the triplet. Now the problem is, how to
count the other three. They cannot be the same value as the triplet,
so we might think there are 5X5x5 choices. But wait, these last
three cannot all
of the same value or we would have a second triplet and we are trying to
calculate the probability of a single triplet. So how about
5x5x5-5=120. And 6x20x120=14400 out of 46656 =
0.308. Hey! That agrees pretty well with the program
results!

**Addendum July 17, 2009: ** I revisited the analytical
solution in V3.0 of the program posted today. I also added
support for dice with fewer than 6 sides. I think that it
produces correct results for dice with 2 to 6 sides and 2 to 6 dice
rolled per trial.

**September 12. 2010: ** A viewer wrote recently who
plays a 5-dice version of poker telling me that my odds for a pair and
three-of-a-kind were too high. And for a poker player, he was
correct. The program was including "full house" results in
one pair and 3-of-a-kind results. (a full house is by definition a
pair and 3-of-a-kind). Since I do list "full house" as one of the
outcomes to be evaluated, I decided that those results should be excluded
from the other categories. With Version 4 posted today, they are.
I also added a button to calculate all results for the 5-dice case
including "straight"s (5 contiguous values) and the "busted" rolls not
otherwise counted.

### Running/Exploring the Program