Saturday, July 12, 2014

Of Orcs and Probability


In the last post, I addressed what in the comments section I called a "category error"—wrongly imputing the existence in the fantasy world of a unit of measurement in the game mechanic that existed only in our world. There are no hit points in the fantasy world, nor are there abilities such as Strength or Constitution, nor +1 modifiers to magic swords, nor players, GM's or potato chips. But there are genes (probably), creatures that are strong or have a sturdy constitution, magic swords of varying utility (some of which talk back to you), player-characters (as opposed to players), gods (sort of like GM's but easier to sweet talk) and almost certainly potatoes. Mixing categories, or mixing up worlds leads to all sorts of errors. Constructing a theory of evolution in the fantasy world based on hit points is a bit like basing it on potato chips.

But I want to leave that point for now. For the fun of it, let's assume that hit points do have a real existence in the fantasy world, like genes perhaps. And thus we can now go along with constructing a kind of evolutionary theory that might show how a community of, say, Orcs has its low hit point members gradually (or not so gradually) weeded out through fighting. There's no question that they would be weeded out eventually, of course, but it might be fun and interesting to track how the process would occur.

The initial set-up was specified in this blog post. You start with 100 one hit die Orcs with an average spread of 1-8 hit points—12.5 would have 1 hit point, 12.5 would have 2 hit points, and so on. They fight three rounds against a similar group of Orcs. Each Orc has an Armor Class of 6 and carries a spear that does 1-6 points of damage. At the end of this, how many Orcs would survive? Perhaps more interestingly, what proportion of each hit point group of Orcs would survive? And how would this change the overall spread of the different hit point groups?
The claim was made that:

From the final count, if we presume that any of these humanoids we're meeting have been in only 3 rounds of combat, only 1 in 100 humanoids should have 1 hit point.  Only 13% should have 3 or less. Nearly half, 45%, should have either 7 or 8 hit points.  More than three quarters, 77%, should have 5 or more.

This is because:

Trying to get my math right here.  The numbers are based on the chances of being hit once plus the chance of being hit twice and the chance of being hit three times, multiplied by the chance of any of those hits killing the humanoid.  The humanoid's attacks are not considered - only the chance of a humanoid with an armor class of 6 surviving three spear attacks during a given combat.

Actually, he didn’t get his math right.

That’s okay, we all make mistakes, and I owe a debt to that blogger for giving me an interesting puzzle in probability to occupy myself for an hour or so after the kids had gone to sleep.

The easiest way of seeing part of it is to focus on the weakest group—the 1 hit point Orcs. All they need is one successful hit against them and they go down. You don’t need to figure out the chances of, say, one hit versus two hits occurring, or how much expected damage might or might not be done with each strike. Rather, it’s quite simple: One hit and you’re dead.

What are the odds that you’ll be hit? Well, flip it—what are the odd’s you won’t be hit? Every round there’s a 60% chance you won’t be hit (1-12 is a miss, 13-20 is a hit). Thus, the odds for surviving three rounds are 60% x 60% x 60%, or roughly 22%. That roughly tracks this blog post’s leading graphic, above. 4 Orcs would reduced to 1.  12.5 Orcs would be reduced to 2.7. However, asking how many 1 hit point Orcs would remain out of 100 survivors has to take into account that many of the other stronger Orcs would also have fallen. As we shall see later, it comes to about 50%. So out of 100 surviving Orcs (imagine you started with 200), there would be 2.7 x 2, or roughly five 1 hit point guys still standing. So the proportion of the wimpiest would have been reduced from 12.5% to 5%. It’s a tough world. But not quite as tough or tough so quickly on the 1 hit point Orcs as was originally claimed. The answer after three rounds is not 1 in 100 but more like 5 in 100.

Quick digression: the original blogger pegged the to hit chances at 35% not 40%. Every early edition of D&D that I’ve seen, from the original 1974 version to the 1e Players Handbook, to Moldvay/Cook has one hit die monsters hitting AC 6 opponents on a 13. So why 35%? Most likely, the blogger made the same mistake that I sometimes make in my head: 13 to hit means a probability to hit of (20-13)/20, right? Wrong. Don’t forget to count the 13. The correct formula is 20 minus the highest roll to miss (12) not the lowest roll to hit (13). Or if you prefer, you can also just add 1 to the numerator. But pegging the chances at 40% rather than 35% actually kills the weaker Orcs quicker. If the chances to hit had only been 35%, then 27% or 3.4 (as opposed to 2.7) would have survived.

Moving on to computing the survival odds for all Orcs, I’m not going to explicitly go through the whole thing, but here’s a sketch:


1. The first thing to do is break down the odds for any Orc in a three round battle being hit 0 times vs. 1 time vs. 2 times vs. 3 times. You can represent it like this:

Permutation
1st round
2nd round
3rd round
# of hits
Probability






1
miss (60%)
miss (60%)
miss (60%)
0
21.6%
2
miss (60%)
miss (60%)
hit (40%)
1
14.4%
3
miss (60%)
hit (40%)
miss (60%)
1
14.4%
4
miss (60%)
hit (40%)
hit (40%)
2
9.6%
5
hit (40%)
miss (60%)
miss (60%)
1
14.4%
6
hit (40%)
miss (60%)
hit (40%)
2
9.6%
7
hit (40%)
hit (40%)
miss (60%)
2
9.6%
8
hit (40%)
hit (40%)
hit (40%)
3
6.4%

This gives totals of:

Chance of 0 hits
21.6%
Chance of 1 hit
43.2%
Chance of 2 hits
28.8%
Chance of 3 hits
6.4%

So, now, without doing any more calculations, we can also see why 7 and 8 hit point Orcs make out so well in the original blogger’s example. Since the maximum damage is 6 hits, an Orc with 7 or 8 hit points must be hit at least two times to be killed (and even then there’s a good chance he won’t be killed). But there’s only about a one-third chance this will happen. Why, in the original example, all the Orcs are fighting with spears as opposed to doing standard damage of 1-8, or using some of the better weapons assigned to Orcs in, say, the Monster Manual is a good question. But it shows up an interesting and almost paradoxical pattern. The less effective the weapons the worse the wimpier Orcs will fare relative to their 7 or 8 hit point comrades. The evolutionary process would happen quicker if Orc armies wielded daggers. Conversely, if the Orcs were all wielding two-handed swords or halberds, the proportions of surviving wimpy Orcs versus surviving strong Orcs would be less pronounced. Even doing the calculations with weapons that did 1-8 points of damage (as opposed to those spears doing only 1-6) would smooth things out on the survival curve (as opposed to the discontinuous break in the original example that separates the 7 hit point and 8 hit point Orcs out from the rest).

2. Now compute the expected damage chances for 1 hit, 2 hits and 3 hits. Here, we’re actually in familiar territory as we’re simply calculating the odds for achieving various totals using 1d6, 2d6 and 3d6. Many OD&D players almost carry those odds around in their heads.

3. Next multiply the two together in all the possible cases. I used an Excel spreadsheet, and again I won’t go though the details, but the final expected survival numbers after 3 rounds of battle are given on this table.

1 hp
2 hp
3 hp
4 hp
5 hp
6 hp
7 hp
8 hp
2.7
3.6
4.6
5.7
6.9
8.2
9.6
10.2

That gives the expected number of survivors as 51.5 out of a starting group of 100.

That’s actually an interesting number. It shows that for one hit die or 1st levelish creatures with moderate armor, if you (as a low level character) fight them for three rounds, you are likely to have reduced their numbers by about half. That’s another morale break point, I think. Low level OD&D combats shouldn’t last very long.

We can rewrite the results using percentages (by dividing the results by 51.5%). Drop the %’s and you have the number of Orcs in each hit point category out of 100 surviving ones:

1 hp
2 hp
3 hp
4 hp
5 hp
6 hp
7 hp
8 hp
5.2%
7.0%
8.9%
11.1%
13.4%
15.9%
18.6%
19.8%

These numbers are closer to those of the original blogger at the high ends (though not at the low ends), though they are still not quite as pronounced.  So replace

Only 13% should have 3 or less. Nearly half, 45%, should have either 7 or 8 hit points.  More than three quarters, 77%, should have 5 or more.

With

Only 21% should have 3 or less. Over a third, 38%, should have either 7 or 8 hit points.  More than two thirds, 68%, should have 5 or more.

Keep in mind, though, that raising the to hit chances to 40% helps the original blogger’s case. The numbers would be even more off if we had stayed with 35%.

Finally, you can rerun the numbers using the new proportions—5.2, 7.0 etc. vs. 12.5, 12.5, etc.—to find results if the surviving Orcs decide to fight additional three round battles. Sure enough, if you fight enough three round battles—3 actually—the wimpy 1 hit point Orcs will be reduced to that magic 1 in 100 number.
  

# Battles
1 hp
2 hp
3 hp
4 hp
5 hp
6 hp
7 hp
8 hp
1
5.2%
7.0%
8.9%
11.1%
13.4%
15.9%
18.6%
19.8%
2
1.9%
3.4%
5.5%
8.4%
12.4%
17.5%
23.9%
27.0%
3
0.6%
1.5%
3.1%
5.8%
10.4%
17.4%
27.9%
33.5%


But these numbers are quite different from those originally claimed:


hp
surviving after three battles


1
1 in 11,248 (!!! -ed.)
2
1 in 252
3
1 in 46
4
1 in 15
5
1 in 6
6
1 in 3
7
4 in 7
8
2 in 3

Again, see here.

Extra credit: instead of computing probability formulas, you can simulate Orc battles using the RANDBETWEEN and IF functions of Excel.

For the first to hit roll on a d20 it’s a1=RANDBETWEEN (1,20), then to compute damage you go b1=IF(a1>=13, RANDBETWEEN (1,6), 0). Do that three times and then add the “damage cells” to determine whether you have a kill. If f2 is the number of starting hit points, then the formula is =IF((b2+d2+e2)>=f2, 1, 0) where 1 is a kill and 0 is a survival. Of course starting hit points can be determined by =RANDBETWEEN(1,8). Or one can simply start out with 12 or 13 in each category. For successive battles featuring survivors, you can use a more complicated RANDBETWEEN or even RAND function using the new proportions.

If anyone has ever done something like this in Excel, you know that once you have the formulas set up, you just have to touch a random non-used cell (or fill it in) to simulate another battle and thus get a different result. It takes less than a second.

Probability can be weird. On only my fifth battle I had a situation where the 1 hit point Orcs actually survived in greater numbers than the 8 hit point Orcs.

More power to them!

Final note: I could of course have made all sorts or errors. If any readers would like to try their hand at identifying them, I would of course be interested and not offended. But please, no four-letter words, Alexis.

5 comments:

  1. Pretty off topic (the math doesn't interest me so much as the thinking behind doing the math) You continue to state that various parts of the rules have no bearing upon the world. Do you assign any value at all to the idea that making sure the world runs in a self consitent way independantly of its interaction with the players?

    I'm just trying to work out this category error, it feels like you're saying that it's silly to use hitpoints as if they existed in the world because hit points are a useful abstraction to allow players to play the game and nothing more. While I'm try to say that we can't really understand a setting without using hitpoints, these creatures are strong and have a sturdy contsitution is an arbitery decision which could mean anything. The fifth tribe of orcs your adventurers slaughter having a higher proportion of orcs with 1 hit point than those with 8 is lucky if the players can identify it and take advantage of it. It's also something differant and puzzling, probability is a wonderful thing.

    ReplyDelete
  2. Yep. You have just successfully arrived at the first set of numbers I generated, and made the same mistake I made the FIRST TIME. See, I was about to post these numbers, then I realized - oops.

    You have to calculate the second hit based on the first round having happened; you can't calculate both the first two rounds as though they happen at the same time. Once the first round occurs, the adjustments for the second round must be adjusted. Then again for the third round and so on.

    But you probably have no idea what I mean. Oh well. I'm just the loud mouth anyway. You're right, I'm wrong. That's the simplest assumption.

    What do I care? I published a book today.

    ReplyDelete
    Replies
    1. So that means in this model, the orcs are actually standing around doing nothing (as opposed to just being moddelled to do so) What you're moddelling by saying that every person that kills an orc lives on to gang up on the rest of the orcs (this is what I take you mean from calculating the second hit based on the first having happened) is a rout. The orcs aren't fighting back, so the concentration of attacks agaisnt them is increasing.

      Not that it matters of course, the purpose of the excercise is show that rolling a d8 is inadequate for determining how many hitpoints an orc who lives in anything but an entirely peaceful society looks like. The two sets of numbers provide just describe differant scales of violent society (or as I prefer to view it differant kinds of violence)

      Delete
  3. It wasn't what I was trying to say, Issara. But . . . I'm going to apologize. After more reflection, I think that Oakes's math is right after all.

    ReplyDelete
  4. Some interesting questions were raised and there are still a few outstanding issues that I might try to address in a final post (if there is any tolerance left for the topic). But real world work considerations are going to intrude for a day or two.

    ReplyDelete