Switch Theme:


Options
Add a New Article

Recent Changes
Your Watchlist
All Articles

View a Random Article
Upload a File

Images Tutorial
Editing Tutorial
Articles Tutorial


Basics of Mathhammer

The Basics of Mathhammer

Written by Redbeard
with 'Standard Deviation and Variance' written by InyokaMadoda


While many people disdain the use of math in playing with their toy soldiers, having an understanding of how probability works can be useful to anyone. It is important to note, of course, that in actual games you have many layers of complexity to take into account that do reduce the relevance of the raw mathematics. One of the keys to understanding Mathhammer is to know when to apply it and when not to.

Basic Probability

So, the first concept to tackle is that of basic probability. This is the way of rendering, into mathematical terms, the chance that something will happen. To consider the most basic case we can examine flipping a coin. When you flip a coin, there is one chance that it will be a heads and one chance that it will be a tails (ignoring the infinitesimal chance that it will land on its edge). That gives you two total chances. The probability of having the coin land on heads is therefore one chance out of two total chances, or 1/2, or 50% or .5 (Many different ways of saying the same thing).

It is important to note that this is the same each time you flip the coin, and that neither the coin, nor mathematics 'remembers' the past. If you flip a fair coin 24 times and get heads each time, the chance that you get a heads on the next flip is still 50%.

Of course, playing dice games, we're more interested in dice than coins. With six-sided dice, you have a total of six possible results, and, assuming fair dice, each result is equally as likely to happen as any other result. This means that the odds of rolling any given number is 1/6, or roughly 17%.

Mutually Exclusive Events

Once we establish that, we also want to know the odds of rolling a given number or higher/lower. One of the basic rules of probability is that the probability of any number of mutually exclusive events happening is equal to the sum of the probabilities of each of those events happening separately. Mutually exclusive means that you can roll a '1' or a '2', but you cannot roll both a '1' and '2' on the same die. So, that means that the odds of rolling '3+' can be stated as the odds of rolling a '3' plus the odds of rolling a '4' plus the odds of rolling a '5' plus the odds of rolling a '6'. Given that the odds of each of these events happening is 1/6, the sum of these events is 1/6 + 1/6 + 1/6 + 1/6, which is 4/6, or simplified, 2/3 (roughly 67%).

Independent Events

We are also interested in the combination of independent events. An example of independent events might be three separate rolls (call them to-hit, to-wound, and save). We are interested in the combined odds that the to-hit die comes up 3 or higher, the to-wound die comes up 4 or higher, and that the save die comes up 2 or lower. As each of these is an independent event, we use another of the basic probability rules, that the probability of a given set of independent events happening together is equal to the product of their individual probabilities. To go back to our dice, the chance that the three rolls above fall the way that they need to in order to cause a casualty are 4/6 * 3/6 * 2/6, or 24/216, which simplifies to 1/9 (roughly 11%).


Multiple Dice

We can also use these two rules to determine the probable outcomes of the sum of two dice. To determine the odds of rolling any given number on two dice, you have to count the total number of possible outcomes, and how many add up to the number you're interested in. The total number of possible outcomes when rolling two dice is 36 ((1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (2,1), (2,2), ...). There are six results that add up to seven ((1,6), (2,5), (3,4), (4,3), (5,2), (6,1)). So the odds that you roll a seven on two dice is 6/36, or 1/6. Using our mutually exclusive rule (as we cannot roll both a seven and an eight), you can find the odds of rolling any given number or higher/lower.

For example, the odds of rolling a nine or less on two dice is expressed as (the odds of rolling a nine) + (odds of rolling an eight) + (odds of rolling a seven) + (odds of rolling a six) + (odds of rolling a five) + (odds of rolling a four) + (odds of rolling a three) + (odds of rolling a two). This works out as (4/36) + (5/36) + (6/36) + (5/36) + (4/36) + (3/36) + (2/36) + (1/36), or 30/36, which simplifies to 5/6 (roughly 83%).


Re-rolls

The last basic concept is that of re-rolls. If you think about it, what a re-roll does is allow you to try again, if the original event was not to your liking. This is really just two mutually exclusive (as it cannot both happen and not happen) events, so you're using the sum rule from above. It's also the combination of two independent events (the first roll failed, and the second roll succeeded). That means that you're combining the odds that the event happens (p) with the odds that (it didn't happen (1-p) and that the re-roll did happen (p)). The odds on the second roll are no different than the odds on the first roll, so that simplifies things, and the formula at the end is p + ((1-p)*p).

Another way to approach this problem is by determining your chance of failure, then subtracting that from 1 to get your chance of success. So the equation is 1 - (1 - p)^2, since the only way to fail is for each roll to fail, and each roll has a 1 - p chance of failing.

Example: Let's say you want to know the odds of hitting with a twin-linked BS3 gun. BS3 means you're hitting on a 4+, so the basic odds (p) are 1/2. Therefore, the odds of hitting with the re-roll are:

  • 1/2 + ((1-1/2)*1/2)
  • 1/2 + (1/2 * 1/2)
  • 1/2+1/4
  • 3/4 (or 75%)

Expected Results

Basic probability deals with the odds that a given thing will happen. More frequently in wargaming, however, we're interested in knowing how much of a thing is likely to happen. Using the rules above, we can, with a lot of math, figure out the exact probabilities that one marine will die when shot by 10 guardsmen. We can also figure out the exact probability that 2 marines will die, and adding them together, the odds that either one or two will die. (These are left as exercises for the masochistic reader).

That's not really very useful, though. What we're more interested in is, if those ten guardsmen fire at a unit of marines, how many marines can they expect to kill. And, fortunately, this is far far easier to compute.

Expected results are, in their basic form, simply the probability that an event happens, multiplied by the number of times it is attempted. For example, if you flip a coin 10 times, how many heads do you expect to see? The answer is simply 10 * 1/2, or 5.

Not much to this... Those ten guardsmen with their lasguns each have a chance to kill a marine equal to 1/2 (to-hit)*1/3 (to-wound)*1/3 (failed save), or 1/18. Ten of them firing, therefore, can expect to kill 10 * 1/18, or 10/18, which simplifies to 5/9, or slightly more than half a marine. (Math does allow for fractional casualties).


Standard Deviation and Variance

Standard deviation and variance are of very limited use for the purposes of gaming and are only for the most die-hard mathhammer gamer. These are definitely not the sort of calculations that can be done during a game and are only of any use when considering your options of which unit to face against which of your opponent’s force or for list building. I have tried to avoid mathematical terms where possible, but unfortunately some are necessary to accurately and adequately describe the situation.

Standard deviation and variance are related statistics, with standard deviation simply being the square root of variance. Since standard deviation is easier to interpret, this is what will be used in this discussion.

Standard deviation gives a measurement of the variability of data, or how spread out it is from the average value. The larger the value of the standard deviation, the greater the variability of the data. For simplicities sake, it can be estimated that roughly 68% of data is within one standard deviation of the mean and roughly 95% of data is within two standard deviations of the mean. For example, if the average height of men was 180cm and the standard deviation was 5cm, then this would mean that roughly 68% of men were between 175 and 185cm tall and 95% of men would be between 170 and 190cm. If the standard deviation were larger, say 8cm, then roughly 68% of men would be between 172 and 188cm and 95% would be between 164 and 196cm, thus showing a greater spread to the data.

Unfortunately, the method for calculating standard deviation depends on the exact situation that you are trying to predict. For the purposes of this article, since we are mainly concerned with how many of one type of enemy model we can kill with a fixed number of our models, the method presented below is suitable for that situation only. Should you be trying to use standard deviation in a different situation, you will probably require an alternative method than the one shown below, since it may be described by a different statistical distribution.

Fortunately, the formula for our situation is relatively simple. Using n = the number of shots being fired and p = the probability of getting a kill, we have:

Standard deviation = square root of (n * p * (1-p)).

So using the example of 10 guardsmen trying to kill marines, from the section on ‘Expected Results’, which had a probability of a kill of 1/18, the standard deviation = square root of (10 * 1/18 * (1-1/18)) = square root of (10/18 * 17/18) = square root of (170/324) = 0.724. What this means is, since we had an expected number of kills of 0.556, 68% of the time, you should expect to kill between 0 and 1.279 marines, and 95% of the time you should expect to kill between 0 and 2.003 marines. Notice that you do not need to extend your boundaries down past zero kills into the negative (!) and that you should not seek to fit the full two or four complete standard deviations in to calculate your 68% and 95% boundaries, by adjusting the upper limits.


Efficiency

Now that we can figure out expected results from performing certain actions, we can start to examine efficiency. Efficiency incorporates the expected results of one set of events, relative to the costs associated with attaining those results.

This is typically done for comparing different units that will be used in the same way, as units that will be used differently simply can't be compared effectively in just mathematical terms.

In order to be relevant, efficiency calculations need to be based on points, not models. The basic concept is that x points of unit A generate a one return, while the same points spent on unit B generate a different result.

But, since you can rarely get two units that cost exactly the same amount, you can divide all your results by the number of points you spend on the unit, and get a return-per-point value.

Examples: 10 Marines with bolters are shooting at a large unit of orks, at 18" range. The expected result from this shooting is 3.33 dead orks. 10 Marines cost 150 points, so that equates to .0222 dead orks per point spent on bolter marines (at that range).

A landspeeder fires at orks at the same range, it's expected to kill 1.33 orks. The landspeeder costs 50 points 1.33 / 50 = .0266 dead orks per point spent.

9 Marines with bolters and one with a heavy bolter, at the same range, expect to kill 4.33 orks, and cost 155 points. The expected kills-per-point here are .0279 orks/point. Clearly the heavy bolter is an excellent buy if you're facing orks as it changes the performance of the squad from below that of the landspeeder to outperforming it.

You can take this one step further. Taking the inverse of the kills-per-point yields how many points you would need to spend to get one kill. If you then divide this by the cost of the orks, you get a point ratio, showing how many points you spent to score how many points in return.

Example: Taking the Landspeeder from above, .0266 orks/point inverses to 37.5 points-per-ork. Orks run six points, so you get a point ratio of 37.5:6, or 6.2:1 This means that each six points you spend on landspeedered will equate to 1 point of orks. Knowing this, you would have to make sure each speeder you had was able to shoot every turn in order to break even. Fortunately, they're fairly long-ranged and fast enough to stay away from the boyz, and have other uses besides just shooting.


Uses

Uses of mathhammer fall into two broad categories. The first is pretty obviously in list design. If you know you want a unit that can do a certain task, and there are several options, you can examine how effective each unit is going to be against a variety of targets and select the one that best accomplishes your goal.

The more useful application, in my opinion, is done while playing games. At some point, you're going to end up in a situation where you need to have an idea what will happen based on your choice of action, in order to plan for your next action.

For example, your opponent has a unit of 5 marines with a lascannon covering a firelane which you want to drive your full transport down. During your movement phase, you need to decide whether to move the tank or not. If the lascannon is still there, you don't want to risk it, but if you can remove the lascannon, you need to get that tank moving. Knowing what elements that you have on the table that can direct fire into those five marines will give you some idea of whether it's safe to move the tank.

Obviously, playing a game with dice doesn't have any sure things, but what you can do is evaluate risk. If, from a combination of everything you can throw at the marines, you can get at least 5 expected kills, then moving the tank is a good risk. If not, it's a more dangerous risk. If your opponent gets lucky with his armour saves, well, things happen. But knowing that the most probable result is that you'll inflict enough casualties to kill off the lascannon puts the odds in your favour of a safe move.

Of course, no one wants to play with someone who pulls out a calculator before every move. Learning to estimate quickly in your head is a valuable skill. Here are some tricks for effective in-game estimation:

  • Take things one step at a time. Estimate how many models will score a hit before thinking about wounds.
  • Only use whole numbers, get rid of fractions at each step.
  • Round in the way most favourable to your opponent. Round hits and wounds down, round saves up. This makes for a more conservative estimate, but more reliable for the purposes you'll want.

Example: You have 10 ork shootaboyz firing at a unit of marines. You want to estimate how many you can kill before deciding whether or not to fire, because if you kill more than 3, you'll deny a charge to another unit.

Actual expected kills = 20 shots * 1/3 * 1/2 * 1/3 = 10/9 dead marines Estimated =

  • 20 shots * 1/3 = 6 hits
  • 6 hits * 1/2 = 3 wounds
  • 3 wounds * 1/3 failed armour saves = 1 dead marine.

Your precision went down a little, but not in a way that changes the actual usefulness of the information. As they're only expected to kill one marine, they might as well open fire and soften those marines up for the other unit's charge.


Discussion

Got Comments? Discuss This Page in the Forums. Click Here.

Share

Share on Facebook