Open this document in the playground · Download source
One die: a map of possible damage
Part A · L01 · 5 minutes · No prerequisites
The situation and question
A weapon in our example rolls one six-sided damage die. We are modelling only that die, not whether an attack hits, armour, or critical hits. What damage values are possible, and how often does each occur?
This is a generic damage component, not a complete game rule.
Predict
Is a 6 less likely than a 1? Can the average damage be a number the die never shows?
Build
d(6) describes all six possible faces of a fair die; it does not roll a random
sample. Parentheses pass information to a function: here, the number of sides.
output presents a result. Its first argument is a title inside quotation marks;
the comma separates that title from the value to report. A line beginning with
# inside code is a comment for people, not an instruction.
# Only the damage die, before other rules.
output("One six-sided damage die", d(6))
One six-sided damage die · DieRoll · mean 3.500
| outcome | % | frac | X/6 |
|---|---|---|---|
| 1 | 16.7 | 1/6 | 1 |
| 2 | 16.7 | 1/6 | 1 |
| 3 | 16.7 | 1/6 | 1 |
| 4 | 16.7 | 1/6 | 1 |
| 5 | 16.7 | 1/6 | 1 |
| 6 | 16.7 | 1/6 | 1 |
Run and read
Open this whole document in the playground and select Run (Shift+Enter). The report shows a distribution: a map from results to their probabilities. The row for 6 has probability 1/6, about 16.67%. So does every other row. This is a deterministic calculation of the finite possibilities, not a simulation.
The mean is 3.5: add 1 through 6 and divide by 6. It describes a long-run average, not a seventh face. The minimum is 1 and the maximum is 6.
Change one thing
Change d(6) to d(8) and update the title. Predict the range first.
Check: the range becomes 1–8, each face has probability 1/8, and the mean is 4.5.
Try it yourself
Make a report for a four-sided damage die without copying the line above.
Answer check: use d(4) as the second argument to output; the mean is 2.5
and each face has probability 25%.
What you now know
A roll value represents all possible results. A report title explains what those results mean at the table. Always check the range before trusting a mean.
Where next
Continue to two dice. Later, the damage rounding recipe transforms a whole damage distribution. That recipe is conditional on the save result.
Content ID: L01 · Review status: pilot