CSC 208-01 (Spring 2023)

Lab: Probability Practice

In this lab, we’ll practice using the fundamental definitions of probability theory to perform some probabilistic computations.

Problem: Roleplaying

In tabletop games such as Dungeons and Dragons, players roll a variety of polyhedral die each with a certain number of sides. To express the number of such dice rolled, we use the notation \(xdy\) to refer to rolling \(x\) dice with \(y\) sides. For example \(1d6\) refers to rolling one six-sided die (with values 1–6). In contrast, \(2d8\) means rolling two eight-sided dice (with values 1–8).

Give combinatorial descriptions for each of the following values:

  1. The probability of succeeding at a medium ability check in Dungeons and Dragons (with no additional modifiers). To succeed at a medium ability check, the player rolls \(1d20\) and succeeds if they get a 15 or higher.

  2. The probability that the player succeeds a medium ability check with disadvantage. A player has disadvantage if the ability check is made under circumstances unfavorable to the player. When a player has disadvantage, in contrast, they roll \(2d20\) and take the lower of the two rolls.

    (Hint: consider what rolls lead to player success in this scenario.)

  3. The probability of succeeding a medium ability check with advantage. A player has advantage if the ability check is made under circumstances that are favorable to the player. When a player has advantage, they roll \(2d20\) and take the higher of the two rolls.

    (Hint: you might find it easier to reason about the situations in which a player fails, instead.)

  4. The probability of resisting a disintegrate spell. Consider a level 6 disintegrate spell. To resist the spell, the victim rolls a single \(d20\) and then adds their dexterity modifier \(d\) to the roll. This is compared to the modified spell-casting ability of the caster, calculated as follows:

    \[ 8 + \text{spellcasting profiency bonus} + \text{intelligence modifier}. \]

    Let \(s\) be the spellcasting bonus and \(i\) be the intelligence modifier. The victim resists the spell if their modified roll is higher than the modified spellcasting ability of the caster.

  5. The probability that a creature survives a magic missile spell cast at level 2. Magic missiles deals \(2d4 + 2\), i.e., two \(d4\)s plus 2 additional damage, to a target (without a chance for resisting or saving). Consider two separate cases, the victim with:

    • 7 hit points.
    • \(h\) hit points, i.e., an arbitrary number of hit points.

    The creature survives if the damage dealt by the spell is less than its remaining hit points.

    (Hint: the space of possible damage values is small enough to hand-calculate. For \(h\) hit points, you’ll need to define the probability as a piecewise function—what should the probabilities of survival be if \(h\) is equal to or less than the minimum damage? The maximum damage?)

  6. The probability of being disintegrated by a disintegrate spell. If a disintegrate spell is not resisted, the victim takes \(10d6 + 40\) damage. If this damage reduces the victim to \(0\) hit points or lower, the target is disintegrated—they cannot be resurrected except through a True Resurrection or Wish spell! Calculate this probability assuming that the dexterity modifier of the victim is \(1\), the spellcasting proficiency bonus of the caster is \(4\), the caster’s intelligence modifier is \(2\), and, in two separate cases, the victim has:

    • \(46\) hit points.
    • \(99\) hit points.

    (Hint: with concrete numbers, you can compute (a) the total number of outcomes possible from the \(10d6\) roll and (b) the total number of ways that the damage roll exceeds the victim’s health. In the second case, you can come up with a formula for all the ways that \(10d6 + 40\) can result in \(99\) or greater damage.)

Problem: Expectations

So far, we have calculated the probability of an event occurring. Suppose that we assign numeric values to each possible event, e.g., an amount of money won if you have a certain hand. We can then use these probabilities to compute the average value of an experiment, called its expected value or expectation.

To formalize this notion, we can create a function \(f : \mathcal{P}(\Omega) \rightarrow \mathbb{R}\) be an interpretation function that takes an event as input and then produces its numeric “value” as output. If \(p : \mathcal{P}(\Omega) \rightarrow \mathbb{R}\) is the probability of an event occurring, then the expected value of the experiment is given by:

\[ \sum_{E \in \mathcal{P}(Q)} f(E) \cdot p(E). \]

In other words, the expectation is the weighted average of all the possible events of the experiment.

  1. Suppose that we draw a poker hand at random and receive the following pay-out depending on the outcome:

    • $1 if we draw a pair.
    • $10 if we draw a full house.
    • $100 if we draw a flush.

    If none of these occurrences happen, we lose $3 dollars. Compute the expectation of this game.

  2. Now consider our Dungeons and Dragon example again. To hit a monster in combat, the player must first roll \(1d20\) to determine if they hit the monster. They hit the monster if the roll equals to or exceeds the monster’s armor class. If they do hit the monster, they roll a certain number of additional dice to determine the amount of damage dealt to the monster.

    Let’s say for the purposes of the problem that the player is equipped with two daggers so they roll \(2d4\) damage if they hit and the monster in question has an armor class of 12. What is the expected amount of damage dealt to the monster by the player in a single attack?