Heroquest


29 Jan 2023 Code on Github

Introduction

HeroQuest is a classic board game that transports players back to the mythical world of fantasy heroes and monsters. Players can choose to take on the role of one of four legendary heroes - a brave barbarian, a powerful wizard, a skilled elf, or a sturdy dwarf - as they embark on a perilous journey through a treacherous dungeon filled with traps, monsters, and treasures. Alternatively, players can also play as the evil wizard Morcar (also known as Zargon in the US), who commands a host of fearsome creatures that lurk within the dungeon's dark corridors.

I got HeroQuest and three expansions (Kellar’s Keep, Return of the Witch Lord, and The Ogre Horde) as a child, and thirty years later, I got the battered box from my parents' house and started playing again with my son. For Christmas 2022, he got the re-released Frozen Horror expansion.

My battered old copy of HeroQuest

Frozen Horror

In the first three quests in the Frozen Horror expansion, you play with just the barbarian with no extra equipment. We found the second game impossible. In single combat against the Polar Warbear the barbarian lost over 20 body points (she only has 8, but we kept going to see how much damage the Warbear would deal). The motivation of this article was calculate the expected amount of damage a Polar Warbear would deal a barbarian to see if we got unlucky or the quest was as impossible as it seemed.

Aside on Yeti hugs

Another reason the quest is all but impossible is that it has a Yeti. Yetis have a hug attack that means if it deals a single damage to a hero, it grabs that hero in a hug rendering them unable to fight. The hero then loses a body point each turn and can only escape if the Yeti is killed. But since there are no other players and the hero can't fight whilst in the hug, they will inevitably die. Hasbro released some bonus content which include the rule that Yetis can't use the hug attack in solo quests.

Combat

Combat in HeroQuest uses six-sided dice which have 3 skulls, 2 white shields and 1 black shield. All characters and monsters in HeroQuest have an attack value, a defence value, and a number of body points (they also have mind points but they are not relevant here).

[Picture of dice]

During combat, the attacker rolls a number of combat dice equal to their attack value and deals damage for each skull (so each die has a ½ chance of dealing damage). The defender then rolls a number of combat dice equal to their defence value. If the defender is a hero, damage is reduced by the number of white shields (so each die has a ⅓ chance of preventing damage). If the defender is a monster, damage is reduced by the number of black shields (so each die has a 1/6 chance of preventing damage). The defender’s body points are then reduced by the remaining damage. If their body points are reduced to zero (or less), they are killed.

[Picture of miniatures in combat]

Barbarian

The barbarian is the strongest fighter among the heroes. The Frozen Horror expansion includes a female barbarian and the first three quests are for her alone.

With no extra equipment or buffs the barbarian has an attack 3. The probability distribution for the damage she can deal is shown in this table.

Damage Probability
$0$ $\frac{1}{8}$
$1$ $\frac{3}{8}$
$2$ $\frac{3}{8}$
$3$ $\frac{1}{8}$

The barbarian’s defence is 2, so the probability distribution for the damage she can prevent is given by this table.

Damage Probability
$0$ $\frac{4}{9}$
$1$ $\frac{4}{9}$
$2$ $\frac{1}{9}$

Goblin

The goblin is the weakest fighter with an attack of 2, a defence of 1, and 1 body point. The probability distributions for the amount of damage it will deal or prevent in a round of combat are shown below.

Attack
Damage Probability
$0$ $\frac{1}{4}$
$1$ $\frac{1}{2}$
$2$ $\frac{1}{4}$
Defense
Damage Probability
$0$ $\frac{5}{6}$
$1$ $\frac{1}{6}$

Barbarian attacks goblin

We can combine the table for damage the barbarian deals with damage the goblin prevents to get the probabilities for each combination.

Damage dealt
0 1 2 3
Damage
prevented
0 $\frac{5}{48}$ $\frac{15}{48}$ $\frac{15}{48}$ $\frac{5}{48}$
1 $\frac{1}{48}$ $\frac{3}{48}$ $\frac{3}{48}$ $\frac{1}{48}$

We can then get a table of the net damage the barbarian could deal in one round of combat and its probability.

Net damage Probability
$0$ $\frac{5}{48} + \frac{1}{48} + \frac{3}{48} = \frac{9}{48}$
$1$ $\frac{15}{48} + \frac{3}{48} = \frac{18}{48}$
$2$ $\frac{15}{48} + \frac{1}{48} = \frac{16}{48}$
$3$ $\frac{5}{48}$

The expected amount of damage the barbarian deals in one round of combat is $\frac{18}{48} + 2 \left(\frac{16}{48}\right) + 3 \left(\frac{5}{48}\right) = \frac{65}{48}$ or about 1.35.

The probability that the barbarian deals at least one damage (and so kills the goblin before it gets a chance to fight back) is $\frac{39}{48} = \frac{13}{16} = 81.25\%$.

Goblin attacks barbarian

We can go through the same process to get a table of net damage the goblin will deal to the barbarian when it attacks.

Net damage Probability
$0$ $\frac{5}{9}$
$1$ $\frac{3}{9}$
$2$ $\frac{1}{9}$

The expected amount of damage the goblin deals in one round of combat is $\frac{3}{9} + 2 \left(\frac{1}{9}\right) = \frac{5}{9}$ or about 0.56.

Fighting to the death

We have calculated the expected amount of damage each fighter will deal in one attack. But fighting continues until one combatant dies (or runs away, but I'm assuming that won't happen). So the question now is, what is the probability of the goblin winning the fight, killing the barbarian? Or, if the barbarian kills the goblin, what’s the expected number of body points she'll lose in the process?

The difficulty with this question is that combat could progress in an infinite number of ways - there is no limit to how often the barbarian or goblin could fail to deal damage before one is killed. Let’s start by trying to calculate the probability of the barbarian killing the goblin without taking any damage.

For the first round of combat, we know there is a $\frac{13}{16}$ chance of dealing 1 or more damage, which will kill the goblin. There is a $\frac{3}{16}$ chance of barbarian missing, allowing the goblin to hit back. If the goblin does attack there is a $\frac{5}{9}$ chance of it missing, giving the barbarian another $\frac{13}{16}$ chance of killing it without taking any damage. And so on.

Markov chains

We can represent the round of combat using a Markov chain, where circles (nodes) represent the different states the game can be in, and arrows (edges) represent how the game moves between states and with what probability. We start the hero's turn and end when the goblin is dead or the hero has taken some damage.

Hero's turn Morcar's turn Goblin killed Hero wounded 3 16 5 9 13 16 4 9

We can simplify the chain slightly by removing the state representing Morcar's turn.

On the Hero's turn, if both she and the goblin miss (probability = $\frac{3}{16} \cdot \frac{5}{9} = \frac{5}{48}$), we end up back on her turn as if nothing had happened. Alternatively, if she misses and goblin hits (probability = $\frac{3}{16} \cdot \frac{4}{9} = \frac{1}{12}$), then we end with the hero wounded.

Hero's turn Goblin killed Hero wounded 5 48 13 16 1 12

We can calculate the probabilities for killing a goblin without taking any damage for for first few rounds. The probability for round 1 is $\frac{13}{16}$, and for each subsequent round it's $\frac{5}{48}$ of the probability for previous round.

Round Probability Cumulative sum
$1$ $\frac{13}{16}$ $81.25\%$
$2$ $\frac{13}{16} \cdot \frac{5}{48}$ $89.71\%$
$3$ $\frac{13}{16} \cdot \left(\frac{5}{48}\right)^2$ $90.60\%$
$4$ $\frac{13}{16} \cdot \left(\frac{5}{48}\right)^3$ $90.69\%$

If we sum up the values, we can see that the probability quickly approaches about $90.7\%$.

There are various ways for find the exact value for the probability we're looking for. One is to use the formula for a geometric series:

$s = a\left(\dfrac{1}{1-r}\right)$, where $a = \frac{13}{16}$, and $r = \frac{5}{48}$. This gives us a probability of $\frac{39}{43}$ or about $90.6977\%$.

We can now create a simple chain showing two outcomes for the combat without any loops.

Hero's turn Goblin killed Hero wounded 39 43 4 43

If we look back at the probabilities for how much damage the goblin deals to the barbarian we can see it is three times more likely to deal one wound compared to two wounds ($\frac{3}{9}$ vs $\frac{1}{9}$). So we can expand out the chain slight to show the two outcomes.

Hero's turn Goblin killed 1 wound 2 wounds 39 43 3 43 1 43

Fighting to the death

Since the probabilities for dealing damage are the same whether the barbarian has 8 body points or 1 we can expand the chain to show all the combat states until the barbarian dies.

In the chain below, states are labelled with a letter and a number. The letter H indicates states when it is the hero's turn; E indicates states when combat has ended because one of the fighters is dead. The number represents the number of body points the hero has, so E0 represents the state where the goblin is victorious.

For clarity I've not shown the probabilities on the edges. The probabilities follow those in the chain above: all vertical edges have a probability of $\frac{39}{43}$; all straight horizontal edges have a probability of $\frac{3}{43}$; all curved edges have a probability of $\frac{1}{43}$.

H8 E8 H7 E7 H6 E6 H5 E5 H4 E4 H3 E3 H2 E2 H1 E1 E0

Since the chain has no loops it's straightforward, if a bit tedious, to start at H8 and calculate the probability of reaching each other state. It was at this point that I wrote some code to help with the calculations. I also wrote some code to simulate combat to check my calculations were reasonable.

This table shows the probability distribution for the final number of body points the barbarian will have at the end of combat.

Body points Probability
$8$ $90.7\%$
$7$ $6.33\%$
$6$ $2.55\%$
$5$ $0.325\%$
$4$ $0.082\%$
$3$ $0.013\%$
$2$ $0.0028\%$
$1$ $0.00051\%$
$0$ $0.00011\%$

The probability that the combat ends with the hero at 0 body points is about 0.00011%, meaning there is about a 1 in 800 000 chance that a goblin could defeat the barbarian in single combat. Not quite one in a million, but pretty close.

The expected damage the barbarian will take is 0.128, so she can be pretty confident of leaving the fight unscathed.

More monsters

Having written the code to calculate the probability of the goblin defeating the barbarian it was easy to calculate all the other combinations of combatants. The number are the odds for the monster beating the hero, so the goblin has a 1 in 800 000 chance of defeating the barbarian.

Barbarian Dwarf Elf Wizard
Goblin 800 000 7 400 2 100 21
Skeleton 150 000 2 100 730 13
Zombie 39 000 760 302 8.2
Orc 4 200 190 93 5.4
Fimir 1 500 88 49 4.0
Mummy 640 47 28 3.1
Gargoyle 135 18 12 2.3

The table shows just how much better a fighter the barbarian is compared to the other characters. This is partly a result of having 8 body points, so being able to survive more rounds of combat, so having more chance of dealing the killing blow. Having said that, when I play, I tend to avoid getting a wizard into combat, so I was surprised to see they have a ~60% chance of defeating a gargoyle by themselves, and will only die to a goblin ~5% of the time.

Since we know probability for the number of body points at the end of combat, we can calculate the expected damage dealt by each monster to each hero.

Barbarian Dwarf Elf Wizard
Goblin 0.13 0.28 0.28 0.73
Skeleton 0.19 0.38 0.38 0.95
Zombie 0.25 0.51 0.51 1.18
Orc 0.32 0.66 0.65 1.4
Fimir 0.43 0.87 0.86 1.67
Mummy 0.56 1.1 1.08 1.93
Gargoyle 0.82 1.54 1.48 2.27

So barbarians can reasonably expect to defeat any of these monsters without taking damage. Even a wizard is fairly safe attacking a goblin. Note that dwarves and elves have the same attack and defence so have almost the same expected damage. The slight differences are due to dwarf having one more body point which means as combat goes on longer against the bigger monsters, they can take more damage without dying.

Bigger monsters, bigger problems

In the original HeroQuest, none of the monsters had more than one body point, not even the special characters. Only in the final quest in Kellar's Keep was there a special gargoyle with three body points. Then in Against the Ogre Horde, they introduced four types of ogres, each with multiple body points.

Because these monsters have more than one body point we can't simplify the combat chains as we did before since we need to keep track of monsters' wounds.

To be continued...