Filtering faces (keep, remove, convert, ignore)
At the table
Rules often treat faces differently: “only 5s and 6s can appear,” or “1–4 don’t count toward the total.” Those are face filters on each die—not the same as “total ≥ 15” from lesson 4.
Try it
Copy the script into the playground editor and click Run.
The script
↗output("high_die", d(6).keep(5..))
output("conditional_pool_sum", dice_pool(3, 6).keep(5..).sum())
output("ignored_pool_sum", dice_pool(3, 6).ignore(1..4).sum())
keep(5..)drops non-matching faces (here 1–4), then renormalizes so only 5 and 6 remain.ignore(1..4)is shorthand forconvert(1..4, 0): low faces still roll, but count as 0 when you sum.- Face specs use the same shapes as in API conventions: a single face,
[1, 2], ranges like5.., orat_least(5). remove(1..4)on a d6 is the same die askeep(5..).
keep vs ignore vs p_ge
| Question | Example |
|---|---|
| Each die can only be 5 or 6, then sum | dice_pool(3, 6).keep(5..).sum() (totals 15–18 only) |
| Full d6, but 1–4 add 0 to the sum | dice_pool(3, 6).ignore(1..4).sum() (totals include 0) |
| Unfiltered 3d6 total at least 15 | 3d6.p_ge(15) |
Try this
- Compare means of
d(6).keep(5..)(5.5) anddice_pool(3, 6).ignore(1..4).sum()(5.5)—same mean, different distributions. - Try
keep(..2)for “only 1 or 2 can appear.”
high_die · DieRoll · mean 5.500
| outcome | % | frac | X/36 |
|---|---|---|---|
| 5 | 50.0 | 1/2 | 18 |
| 6 | 50.0 | 1/2 | 18 |
conditional_pool_sum · DieRoll · mean 16.500
| outcome | % | frac | X/36 |
|---|---|---|---|
| 15 | 12.5 | 1/8 | 5 |
| 16 | 37.5 | 3/8 | 14 |
| 17 | 37.5 | 3/8 | 14 |
| 18 | 12.5 | 1/8 | 5 |
ignored_pool_sum · DieRoll · mean 5.500
| outcome | % | frac | X/36 |
|---|---|---|---|
| 0 | 29.6 | 8/27 | 11 |
| 5 | 22.2 | 2/9 | 8 |
| 6 | 22.2 | 2/9 | 8 |
| 10 | 5.56 | 1/18 | 2 |
| 11 | 11.1 | 1/9 | 4 |
| 12 | 5.56 | 1/18 | 2 |
| 15 | 0.46 | 1/216 | 0 |
| 16 | 1.39 | 1/72 | 1 |
| 17 | 1.39 | 1/72 | 1 |
| 18 | 0.46 | 1/216 | 0 |