## Visual mathhammer for 8th edition

### Introduction to plots

The charts and numbers below visually present the distribution of total wounds lost for various attack situations under 8th edition rules. The plots allow to get an intuitive sense of the importance of statlines, and also report the "expected" number of wounds, the number you would get on average if you keep repeating this situation. Each bar shows the probability of the targeted unit losing a certain number of wounds, after all rolls and checks. The expectation should be interpreted with caution — an expectation of x does not, in general, mean that in 50% of the cases the attacker will deal x or more damage.

Let us start with a simple case to illustrate the approach, here we consider a squad of 10 Guardsmen firing 10 Lasgun shots into an identical counterpart. The to chance hit is 3+, or 1 / 2, same for the chance to wound of S3 weapon into T3 models, and the a save of 5+ gives a probability of 4 / 6 for the wound to be left standing.

``````

In [16]:

profiles[0] = {'shots': 10, 'p_hit': 1 / 2, 'p_wound': 1 / 2, 'p_unsaved': 4 / 6, 'damage': '1'}
profile_damage = damage_dealt(profiles[0])
wound_chart(profile_damage, profiles)

``````
``````

``````

As you can see, the squad has about 47% chance of scoring 1 or 0 hits and around 53% chance of scoring 2 or more hits. The expectation is 1.7, which is misleading: the squad actually has better than even odds of getting 2+ hits. The biggest takeaway is that you can only really count on getting 1 hit, and even then you will be frustrated every sixth roll.

Let us take a look at how orders affect things. First we put our squad under 'Take Aim!' increasing the to hit chance to 0.583:

``````

In [18]:

profiles[0]['p_hit'] = 0.583
wound_chart(damage_dealt(profiles[0]), profiles)

``````
``````

``````

The distribution shifted to the right, the chance to score 2+ hits went up to around 62%, but really the effect is negligible, with the re-roll still just as likely to miss as it is to hit. Now let's look at 'First Rank Fire!, Second Rank Fire!', which turns Lasguns into Rapid Fire 2 weapons:

``````

In [19]:

profiles[0]['p_hit'] = 0.5
profiles[0]['shots'] = 20
wound_chart(damage_dealt(profiles[0]), profiles)

``````
``````

``````

A much stronger effect. You still cannot really rely on getting 3+ hits (~70% chance), but they will happen often enough and rarely would you get less than 2.

Now consider Veterans, who can shoot somewhat better and cost 6 points against 4 per a regular squaddie, what does that improvement in Ballistic Skill actually yield?

``````

In [25]:

profiles[0]['shots'] = 10
profiles[0]['p_hit'] = 2 / 3
wound_chart(damage_dealt(profiles[0]), profiles)

``````
``````

``````

Maybe not as much as one would think, the chance to score 2+ has gone up to around 68%, compared to the troop squad's 53%. If you have 60 points to spend, you are probably better off with 15 regular shots:

``````

In [26]:

profiles[0]['shots'] = 15
profiles[0]['p_hit'] = 1 / 2
wound_chart(damage_dealt(profiles[0]), profiles)

``````
``````

``````

And if you double the rate of fire with the order, the difference becomes twice as pronounced.

In this section, we looked at some of the simplest possible plots to get an idea of how they can be used to describe attack situation and judge the usefulness of specific models or effects. The next section starts using these plots in earnest to look at outcomes and advance thinking about the game. At first we look how truncation impacts the probabilities and why using the naive approach of multiplying across statlines for an estimate of the "average" number of wounds is not a good idea.

Go to next section — https://github.com/B4cchus/wh40k-hitscalc/blob/master/Mathammer-Truncation.ipynb