ᚱᛗ
© 2022
Powered by Hugo

Probability in the Game of Craps

Table of Contents

Definining the Game

Craps is a dice game. The most basic bet in craps is the Pass Line Bet (or betting “with the dice”). It works as follows1. In the first roll (the “come out roll”), you roll a pair of dice and sum their outcomes:

  • You win if you roll a 7 or 11
  • You lose if you roll a 2, 3, or 12
  • For any other roll (4, 5, 6, 8, 9, 10), you neither win nor lose but establish a “point”
  • Once you’ve rolled a point you can only win the game if you roll the same point again before rolling a 7. If you roll a 7 first, you lose (aka to “seven out” or to “crap out”)

Probability Space of Two-Dice Throws

In probability theory, a probability space or a probability triple (\(\Omega, \mathcal {F}, P \)), is a mathematical construct that provides a formal model of a random process or “experiment”. Let’s review each component.

Theory

  • \(\Omega \): represents the sample space, that is to say, the set of all possible outcomes or elementary events from the relevant experiment. In this case, the experiment is throwing two dice, and the elementary events are given by every possible combination of the 2 throws. Each die has 6 values, so the sample space has cardinality 36 (6x6).

  • \(\mathcal {F}\): represents the event space. Events are relevant subsets of the sample space that we wish to study. For example, rolling a 3 is the event given by the subset of outcomes \( \{(1-2), (2-1)\} \), of cardinality 2.

  • \(P\): represents the probability function, which assigns a number from 0 to 1 to each event in the event space. \( P(\Omega)=1 \).

Computation

The computation of the probability space can be done in Python with a single function that returns the three components defined above.

# imports
import itertools  # used to create the sample space as a product of two lists
# define the function
def compute_probability_space(die1, die2):
    """
    Compute the probability space of two-dice throws.

    Params:
        - die1: list containing the six face values of the first die
        - die2: list containing the six face values of the second die
    Returns:
        - sample_space: list with all possible combinations of rolls
        - event_space: dict with events as keys and outcomes as values
        - probabilities: dict with events as keys and probabilities as values
    Raises: AssertionError if the probability of the sample space isn't 1
    """
    sample_space = list(itertools.product(die1, die2))
    event_space, probabilities = {}, {}
    for roll in sample_space:
        if sum(roll) in probabilities.keys():
            event_space[sum(roll)].append(roll)
            probabilities[sum(roll)] += 1
        else:
            event_space[sum(roll)] = [roll]
            probabilities[sum(roll)] = 1
    omega = 0
    n = len(sample_space)
    for k in probabilities.keys():
        omega += probabilities[k]
        probabilities[k] = str(probabilities[k]) + "/" + str(n)
    assert omega == n  # P(Omega) = P(sample space) = 1
    return sample_space, event_space, probabilities
# call the function
die1 = die2 = [1, 2, 3, 4, 5, 6]
Omega, F, P = compute_probability_space(die1, die2)
print(Omega)  # sample space
# [(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 2), (2, 3),
# (2, 4), (2, 5), (2, 6), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6),
# (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (5, 1), (5, 2), (5, 3),
# (5, 4), (5, 5), (5, 6), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)]

print(F)  # event space
# {2: [(1, 1)], 3: [(1, 2), (2, 1)], 4: [(1, 3), (2, 2), (3, 1)], 5: [(1, 4),
# (2, 3), (3, 2), (4, 1)], 6: [(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)],
# 7: [(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1)], 8: [(2, 6), (3, 5),
# (4, 4), (5, 3), (6, 2)], 9: [(3, 6), (4, 5), (5, 4), (6, 3)], 10: [(4, 6),
# (5, 5), (6, 4)], 11: [(5, 6), (6, 5)], 12: [(6, 6)]}

print(P)  # probability
# {2: '1/36', 3: '2/36', 4: '3/36', 5: '4/36', 6: '5/36', 7: '6/36',
# 8: '5/36', 9: '4/36', 10: '3/36', 11: '2/36', 12: '1/36'}

Tabulation

We can summarize this probability space as follows.

Event Outcomes Prob
2 {(1-1)} 1/36
3 {(1-2), (2-1)} 2/36
4 {(1-3), (2-2), (3-1)} 3/36
5 {(1-4), (2-3), (3-2), (4-1)} 4/36
6 {(1-5), (2-4), (3-3), (4-2), (5-1)} 5/36
7 {(1-6), (2-5), (3-4), (4-3), (5-2), (6-1)} 6/36
8 {(2-6), (3-5), (4-4), (5-3), (6-2)} 5/36
9 {(3-6), (4-5), (5-4), (6-3)} 4/36
10 {(4-6), (5-5), (6-4)} 3/36
11 {(5-6), (6-5)} 2/36
12 {(6-6)} 1/36

Probability of Winning the Game

Based on the game’s rules, there are two ways to win: 1) on the first roll (FR) by getting a 7 or 11; or 2) on a point roll (PR) by re-rolling the same point [obtained in the first throw]. Therefore, the total probability of winning is the union of these two probabilities—this is stated in equation (1) below. Let’s flesh out this equation and calculate the two terms.

Probability Equations

\[ P(Win) = P(WinFR) + P(WinPR) \hspace{1.5cm} (1) \]

The probability of winning on the first roll, \( P(WinFR) \), is straightforward:

\[ P(WinFR) = P(7) + P(11) = \frac{6}{36} + \frac{2}{36} = \frac{8}{36} \hspace{1cm} (2) \]

The probability of winning on a point roll needs as bit more work. First, we define the probability of rolling a point on the first roll as \( p \). After getting the point, the game continues by re-rolling the dice until either of these two events happens: the same point is rolled again (win), or a 7 turns up (lose).

In this two-event universe the probability of re-rolling the point is \( p/(p+q) \); similarly, the probability of rolling a 7 is \( q/(p+q) \) . Thus the probability of winning by a single point is \( p^{2}/(p+q) \)—where \( p \) varies by specific point. There are 6 points that could come out of the first roll, and they all contribute to the overall probability of winning by points, \( P(WinPR) \). This is summarized in equation (3).

\[ P(WinPR) = \Sigma_{point} \hspace{0.1cm} [p^{2}/(p+q)] \hspace{0.2cm} \forall point \in \{4, 5, 6, 8, 9, 10\} \hspace{0.9cm} (3) \]

For example, for \(points \in \{4,10\} \), the numbers look like this:

\[ P(WinPR_4) = P(WinPR_{10}) = \frac{(\frac{3}{36})^{2}}{\frac{3}{36}+\frac{6}{36} } = \frac{\frac{1}{144}}{\frac{1}{4}} = \frac{1}{36} \]

Per (3), this procedure is to be repeated for all the points, and the results added up.

Python Wrapper

Having understood the math, we can streamline the entire set of computations embedded in (1) with a single function:

# imports
from fractions import Fraction
# define the function
def compute_pwin(probs):
    """Compute the probability of winning a game of craps.

    Params:
        - probs: dictionary of event probabilities for two-dice throws
    Returns:
        - pwin_fr: fraction; probability of winning via first roll
        - pwin_pr: fraction; probability of winning via point rolls
        - pwin: fraction; overall probability of winning the game
    """
    pwin_fr = Fraction(probs.get(7)) + Fraction(probs.get(11))
    pwin_pr = 0
    points = [4, 5, 6, 8, 9, 10]
    q = probs.get(7)  # probability of crapping out
    for point in points:
        p = probs.get(point)
        pwin_point = Fraction(p) ** 2 / (Fraction(p) + Fraction(q))
        pwin_pr += pwin_point
    return pwin_fr, pwin_pr, pwin_fr + pwin_pr

# call the function and print the results
pwin_fr, pwin_pr, pwin = compute_pwin(P) # pwin: Fraction(244, 495)
pwin_fr_d = float(pwin_fr) # decimal
pwin_pr_d = float(pwin_pr)
pwin_d = float(pwin)
plose_d = float(1 - pwin)
print(f"pwin_fr={pwin_fr}; pwin_pr={pwin_pr}; pwin={pwin}")
# pwin_fr=2/9; pwin_pr=134/495; pwin=244/495
print(f"pwin_fr={pwin_fr_d:.3f}; pwin_pr={pwin_pr_d:.3f}; pwin={pwin_d:.5f}")
# pwin_fr=0.222; pwin_pr=0.271; pwin=0.49293
print(f"plose={plose_d:.5f}")
# plose=0.5070

Concluding remarks

Summarizing the results from the snippet above:


Notes


  1. Craps Basics —The Venetian Resort Las Vegas ↩︎

  2. Which is 99.99% identical to the decimal representation of \( \sqrt{2} \). Both a coincidence and a good mnemonic. ↩︎

  3. Also notice that once at the stage where a point is already rolled, the likeliest scenario is to throw a null throw and having to reroll. E.g. for the case of 4 (and by extension of 10), rolling anything other than 4 or 7 (i.e. a null throw) occurs with probability \( \frac{27}{36} = \frac{3}{4} = 0.75 \). Almost as if the game was designed to keep you playing… ↩︎