Open this document in the playground · Download source
Modifiers: move the results, not their chances
Part A · L03 · 5–10 minutes · Prerequisite: L02
The situation and question
Our generic task rule adds a fixed +2 modifier to a two-d6 total. How does that bonus change the possible totals? This is a scoped arithmetic component; it does not yet implement any named game's difficulty or exception rules.
Predict
Will +2 make the distribution wider, or move every result two places higher?
Build
An assignment such as modifier = 2 gives a value a name. Later lines can use
that name instead of repeating the number. A descriptive name makes a safe
editing point—a parameter—easy to find.
total below is a distribution, not one secretly rolled number. modified
adds the same fixed number to every possible total. = assigns a name; it does
not ask whether two values are equal.
modifier = 2
total = d(6) + d(6)
modified = total + modifier
output("Before the modifier", total)
output("After the modifier", modified)
Before the modifier · DieRoll · mean 7.000
| outcome | % | frac | X/36 |
|---|---|---|---|
| 2 | 2.78 | 1/36 | 1 |
| 3 | 5.56 | 1/18 | 2 |
| 4 | 8.33 | 1/12 | 3 |
| 5 | 11.1 | 1/9 | 4 |
| 6 | 13.9 | 5/36 | 5 |
| 7 | 16.7 | 1/6 | 6 |
| 8 | 13.9 | 5/36 | 5 |
| 9 | 11.1 | 1/9 | 4 |
| 10 | 8.33 | 1/12 | 3 |
| 11 | 5.56 | 1/18 | 2 |
| 12 | 2.78 | 1/36 | 1 |
After the modifier · DieRoll · mean 9.000
| outcome | % | frac | X/36 |
|---|---|---|---|
| 4 | 2.78 | 1/36 | 1 |
| 5 | 5.56 | 1/18 | 2 |
| 6 | 8.33 | 1/12 | 3 |
| 7 | 11.1 | 1/9 | 4 |
| 8 | 13.9 | 5/36 | 5 |
| 9 | 16.7 | 1/6 | 6 |
| 10 | 13.9 | 5/36 | 5 |
| 11 | 11.1 | 1/9 | 4 |
| 12 | 8.33 | 1/12 | 3 |
| 13 | 5.56 | 1/18 | 2 |
| 14 | 2.78 | 1/36 | 1 |
Run and read
Before the modifier, the range is 2–12 and the mean is 7. Afterwards, the range is 4–14 and the mean is 9. The old chance of 7, 6/36, is now the chance of 9. No probability changes: only the labels on the numeric results move.
Change one thing
Set modifier = -1. The minus sign makes this a penalty.
Check: the range becomes 1–11 and the mean becomes 6.
Try it yourself
Write a one-d8 roll with a named +3 bonus and a descriptive output title.
Answer check: assigning bonus = 3, then reporting d(8) + bonus, gives
range 4–11 and mean 7.5. Each result still has probability 1/8.
What you now know
Names let you separate a rule's inputs from its calculation. A flat modifier shifts a distribution without changing its shape.
Where next
Previous: two dice · Next: success. For a named-game application, see ordinary D&D ability checks; attack-specific natural-face rules must not be assumed for ordinary checks.
Content ID: L03 · Review status: pilot