2026-06-08

What is Warhammer 40k?

Warhammer 40,000, often called Warhammer 40k, is a tabletop strategy game where players control armies of miniature models.

Players move units, control objectives, and resolve combat using dice.

Because many important outcomes depend on dice rolls, Warhammer 40k is a natural setting for statistics.

In this presentation, we use probability, expected value, and simulation to estimate expected damage.

Why Statistics Applies

A simplified attack sequence looks like this:

Number of attacks → Hit rolls → Wound rolls → Saving throws → Damage

Each step has uncertainty.

Statistics helps answer:

Before rolling the dice, how much damage should we expect?

This type of analysis is often called MathHammer.

Expected Damage Formula

Let:

  • \(A\) = number of attacks
  • \(P(H)\) = probability an attack hits
  • \(P(W)\) = probability a hit wounds
  • \(P(FS)\) = probability the target fails its save
  • \(d\) = damage per unsaved wound

\[ E[D] = A \cdot P(H) \cdot P(W) \cdot P(FS) \cdot d \]

Worked Example

Suppose an attack has:

  • 12 attacks
  • Hits on 3+
  • Wounds on 4+
  • Target saves on 5+
  • Damage 2

\[ E[D] = 12 \cdot \frac{4}{6} \cdot \frac{3}{6} \cdot \frac{4}{6} \cdot 2 \]

\[ E[D] \approx 5.33 \]

So this attack is expected to deal about 5.33 damage.

Simulated Damage Distribution

The dashed line shows the theoretical expected damage.

Expected Damage by Target Save

Better saves reduce the probability of failed saves, lowering expected damage.

Strength vs Toughness

In Warhammer 40k, the wound roll depends on the relationship between the weapon’s Strength and the target’s Toughness.

\[ E[D] = A \cdot P(H) \cdot P(W_{S,T}) \cdot P(FS) \cdot d \]

Here, \(P(W_{S,T})\) changes based on Strength and Toughness.

The next slide uses an interactive Plotly heatmap. The color shows expected damage, and hovering shows the wound roll needed.

Interactive Strength vs Toughness Heatmap

R Code Used

roll_prob <- function(needed) {
  (7 - needed) / 6
}

expected_damage <- function(attacks, hit_needed, wound_needed, save_needed, damage) {
  attacks *
    roll_prob(hit_needed) *
    roll_prob(wound_needed) *
    (1 - roll_prob(save_needed)) *
    damage
}

expected_damage(
  attacks = 12,
  hit_needed = 3,
  wound_needed = 4,
  save_needed = 5,
  damage = 2
)

Limitations of the Model

This is a simplified model.

It assumes:

  • A fixed number of attacks
  • A fixed damage value
  • No rerolls
  • No critical hits
  • No special abilities
  • No variable damage

Real Warhammer 40k combat can be more complicated, but this simplified version shows the statistical foundation clearly.

Conclusion

MathHammer turns dice-based combat into a probability problem.

Main ideas:

  • Expected value estimates average damage.
  • Simulation shows how much results can vary.
  • Strength and Toughness create threshold-based wound probabilities.
  • Better saves reduce expected damage.
  • Statistics helps compare options before rolling dice.

The key lesson is:

Expected damage is not a prediction of one roll. It is the long-run average over many similar attacks.