Dice Probabilities

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

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 

bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

(Mostly done) July  2009: ,Add theoretical calculated probabilities for both types of rolls, "matched sets': and 'number of dots".

 

Original Date: December 18, 2005 

Modified: May 15, 2018

 
  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2018, Gary Darby    All rights reserved.