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
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
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.
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.
365 Puzzlers Calendar 2017
365 Puzzlers Calendar 2018
(Hint: If you can
wait, current year calendars are usually on sale in January.)
e-mail with your comments about this program (or anything else).
Calculate the probabilities of winning or losing for each
outcome for the dice game of Craps.
Background & Techniques
is a dice game with scoring based sum of rolling 2 dice. A game ends in
a single roll if the player wins if he rolls a 7 or 11 (a Natural), or
loses if he rolls a 2, 3, or 12 (Craps).
If the first roll is one of the other possibilities, 4, 5, 6, 8, 9, or
10, that sum is called the "point". and the game continues with
additional rolls until the point is rolled again (a win) or a 7 is
rolled (a loss).
This program calculates the theoretical chances of winning or losing for
each of the eleven initial roll possible outcomes (2 through 12). It
also has a page which simulates a million games to verify that the
theoretical results are valid.
The math is mostly "Probability 101" level. By definition, the
probability of an particular outcome for an event is the number ways
that outcome can occur divided by the total number of outcomes.
When rolling two standard six sided dice, there are 36 possible
outcomes. For each of the 6 outcomes for die A there are six
possible outcomes for die B. The number of occurrences for each
sum are shown in this table:
|Sum of dice values
|Number of outcomes (36 total)
So, for example, the probability of rolling a 11 sum in a
single roll is 2/36 or 1/18. That takes care of the winning
or losing probabilities for the naturals (7,11) and the craps (2,3,12)
For the "point" outcomes (4,5,6,8,.9,10) things get slightly more
complicated. To win with any given point, two events must occur,
we must roll the point on the first roll, then we must roll the point
again before we roll a 7. Each roll is an independent event so the
probability that both will occur is the product of the two events.
The first event is as described above but for the second event, the
probability depends on the relative frequency of the point and 7.
So for example if the point is 4, it can occur in 3 ways, but 7 can
occur in 6 ways. While rolling for point, any outcome that is not
the point or a 7 is ignored so on our example, there are 9 outcomes
which count. Three of these are winners (the point) and six are
losers (the 7s). Therefore the probability of winning with a 4 is 3/36 *
(3/9) = 1/36.
If you follow that, the rest is a piece of cake.
Running/Exploring the Program
Suggestions for Further Explorations
|Original Date: June 25, 2010
July 29, 2017