User guide All recipes Tutorial Function reference Open playground

Open this document in the playground · Download source

Count, any, and enough hits

C01 · Intermediate · Scoped component

Question and scope

In a generic hits-counting component, each d6 showing 5 or 6 is one hit. Roll three dice. Is the average number of hits the same thing as the chance of at least one hit? Predict before running.

Source sections are linked under Rules below; primary-source review is recorded in the release dossier. Independent human and browser/usability review are separate gates.

Inputs and model limits

Three independent fair d6; 5–6 count as hits. Alter the matching faces deliberately; this is not a full Shadowrun rule.

Complete runnable model

.count([5, 6]) preserves the chance of each possible number of matching dice. The brackets describe acceptable faces, not two separate throws. .p_at_least(2, [5, 6]) queries whether enough dice match.

pool = dice_pool(3, 6)
hits = pool.count([5, 6])
output("Number of hits", hits)
output("Any hit", pool.p_any([5, 6]))
output("At least two hits", pool.p_at_least(2, [5, 6]))

Number of hits · DieRoll · mean 1.000

outcome%fracX/27
029.68/278
144.44/912
222.22/96
33.701/271

Any hit · Prob

outcome%fracX/27
Any hit70.419/2719

At least two hits · Prob

outcome%fracX/27
At least two hits25.97/277

Reading the report and independent checks

Counts 0,1,2,3 have probabilities 8/27,12/27,6/27,1/27. Mean hits is 1; any hit is 19/27, and at least two is 7/27. A mean count of 1 is not a 100% success chance. For zero hits, all three dice must miss: (2/3)^3.

Safe changes

Count sixes only. Mean hits falls to 1/2; at least two sixes is 16/216 = 2/27.

Composition and boundary checks

Build a two-die count report for 5–6. Answer: probabilities 4/9,4/9,1/9 for counts 0,1,2. Checkpoint: choose .sum, .p_any, or .count based on whether the rule asks for total, any match, or number of matches.

Do not combine separate marginal reports and assume they preserve the same rolled faces. When an event depends on several properties of one roll, keep those properties together inside a single classifier or pool callback.

Rules

Generic building block. It resembles a raw-hits component used by some games, but makes no claim to implement Shadowrun 5e limits, Edge, or glitches; edition-source verification is still required for that named recipe.

Related learning

Lesson L15 explains the modelling idea step by step. Cookbook index offers both game and mechanic views of these same recipes.

Content ID: C01 · Review status: pilot

Prerequisites: L15