Note: there's some errata for this post here.

On the other hand, each of these units start with a different number of figures based on the type: Infantry have 4, Armor 3, and Artillery 2. This means that while Artillery are the hardest to hit, you need fewest hits to eliminate each one. Let's evaluate which of these effects win out. To do this, we'll determine how many dice it may take to eliminate each unit type.

It's tempting to think that we should look at the binomial distribution of the number of hits for different numbers of dice rolled. However, that would give us the probability that we get enough hits to eliminate a unit given that we roll a certain number of dice. For a small number of dice, which may be rolled in a single attack, that is correct, but for larger numbers, where dice are rolled across multiple attacks, it is wrong for the simple reason that can't attack a unit that's already eliminated. The probability of getting 4 hits when rolling 10 dice includes cases when the first 4 dice all get hits, so we'd never roll the subsequent 6 six. Another way of thinking about it, is that the binomial distribution could tell us what the probability is of eliminating a unit with up to a certain number of dice.

Instead, we'll consider rolling 1 attack die at a time. This sounds like the opposite extreme, but it applies directly to some cases and represents rolling multiple dice in each attack as well as we can, considering extra hits go unused. Right away we see some difference. For example, we can eliminate an Artillery unit with just 2 attack dice with a probability of $(\frac{1}{6})^2\approx 0.0278$, while the probability for Armor and Artillery is zero, since they have more than 2 figures each.

Let's assign some variables. Let's say the number of starting figures of a unit is $f$, the number of dice rolled to eliminate the target unit is a random variable $N$, and the probability of each die hitting is $p$. We'll use subscripts to denote the units. To eliminate a unit on the $n$-th roll, the $n$-th roll must be a hit and there must be exactly $f-1$ hits accumulated on previous rolls, for $f$ total hits. Since the number of hits and misses must sum to $n$, the number of misses is $n - f$. Here, we'll leverage the binomial distribution to find the probability of getting $f-1$ hits in $n-1$ rolls, which has the probability mass function (pmf) $f_\text{binomial}(f-1; n-1,p)$. We can thus assemble the pmf of $N$, $f_N(n) = P(N= n)$, as follows.

\begin{align}

f_N(n) &= f_\text{binomial}(f-1; n-1, p) \cdot p \\

&= \binom{n-1}{f-1} \cdot p^{f-1} \cdot (1-p)^{(n-1)-(f-1)} \cdot p \\

&= \binom{n-1}{f-1} \cdot p^f \cdot (1-p)^{n-f}

\end{align}

Plugging in the binomial coefficient $n-1$ choose $f-1$, $\binom{n-1}{f-1}$, we find the following. Note that we should pay attention to the range of $n$ over which this is value. When $n < f$, we haven't rolled enough dice to to be able to eliminate the target unit. Earlier, with the binomial coefficient, this was somewhat implied, as we cannot, for example, choose 4 dice out of 3.

\begin{align}

f_N(n) &= \frac{(n-1)!}{(f-1)! ((n-1)-(f-1))!} \cdot p^f \cdot (1-p)^{n-f} && f \leq n \\

&= \frac{(n-1)!}{(f-1)! (n-f)!} \cdot p^f \cdot (1-p)^{n-f} && f \leq n \\

\end{align}

Here we've computed the pmf of the number of dice it takes to eliminate a unit, which I've plotted in Fig. 1. This naturally starts at 0 for $n < f$ and approaches 0 again for high $n$. This is because the sum over all $n$ must be 1, as the sum of the probabilities of all possibilities is 1. For each higher $n$, it's more and more likely that you would have eliminated the target in less than $n$ rolls.

Fig. 1: Memoir '44 probability of unit elimination |

One striking feature of the plot is that for every unit type, the probability of elimination peaks at 6 and 7 dice, which appear to have equal probabilities. To check this, we can look at the difference equation for $f_N(n)$, which is similar to taking a derivative, but for functions of discrete-valued variables. Sometimes we might get away with using a derivative as a shortcut, however, the binomial coefficient here will get in our way. So what we want to look at is the difference of $f_N(n+1)$ and $f_N(n)$.

\begin{multline}

f_N(n+1) - f_N(n) = \frac{(n+1-1)!}{(f-1)! (n+1-f)!} \cdot p^f \cdot (1-p)^{n+1-f} \\- \frac{(n-1)!}{(f-1)! (n-f)!} \cdot p^f \cdot (1-p)^{n-f} \\

\end{multline}

Here, it's perhaps easier if we can write $f_N(n+1)$ in terms of $f_N(n)$, in order to express the difference more clearly.

\begin{align}

f_N(n+1) &= \frac{(n+1-1)!}{(f-1)! (n+1-f)!} \cdot p^f \cdot (1-p)^{n+1-f} \\

&= \frac{n}{n+1-f} \cdot p \cdot \frac{(n-1)!}{(f-1)! (n-f)!} \cdot p^f \cdot (1-p)^{n-f} \\

&= \frac{n}{n+1-f} \cdot (1- p) \cdot f_N(n)

\end{align}

Which gives us the difference as,

\begin{align}

f_N(n+1) - f_N(n) &= \left ( \frac{n \cdot (1- p)}{n+1-f} - 1 \right) \cdot f_N(n). \\

\end{align}

Or more explicitly,

\begin{multline}

f_N(n+1) - f_N(n) \\= \left ( \frac{n \cdot (1- p)}{n+1-f} - 1 \right) \cdot \frac{(n-1)!}{(f-1)! (n-f)!} \cdot p^f \cdot (1-p)^{n-f} .

\end{multline}

Now, $f_N(n)$ is non-negative, as it is a probability. That is $f_N(n) \geq 0$. Thus, any sign change in the difference must come from the first term, $ \left ( \frac{n \cdot (1- p)}{n+1-f} - 1 \right)$. Let's solve for when this is zero to look for the maxima that we observe.

\begin{align}

0 &= \left ( \frac{n \cdot (1- p)}{n+1-f} - 1 \right) \\

1 &= \frac{n \cdot (1- p)}{n+1-f} \\

n+1-f & = n \cdot (1- p) \\

\require{cancel}\cancel{n}+1-f & = \cancel{n} - n\cdot p \\

1-f & = - n\cdot p \\

n\cdot p &= f - 1\\

n & = \frac{f-1}{p}

\end{align}

Now, note that we do have an interesting relationship between $f$ and $p$ for all three units.

\begin{align}

f_\text{infantry} &= 4 & p_\text{infantry} &= \frac{3}{6} \\

f_\text{armor} &= 3 & p_\text{armor} &= \frac{2}{6} \\

f_\text{artillery} &= 2 & p_\text{artillery} &= \frac{1}{6} \\

\end{align}

In each case we have the following relation.

\begin{align}

p = \frac{f-1}{6}

\end{align}

Plugging this into our equation for when the difference $f_N(n+1) - f_N(n) = 0$, we find that the difference is indeed zero.

\begin{align}

n & = \frac{f-1}{p}\\

& = \frac{\require{cancel}\cancel{f-1}}{\left (\cfrac{\cancel{f-1}}{6} \right )} \\

n& = 6

\end{align}

Thus, the probability of eliminating a unit when rolling the 6th die is the same as when rolling the 7th die, for all these unit types. If we had a unit that started with 5 figures and were hit with probability $4/6$, it would also have this property.

Looking at just the pmf doesn't give us a clear picture of which is best. The distribution for artillery is shorter and fatter than infantry. Another comparison we can make is to look at the probability that a unit is eliminated by the $n$-th die, that is, with $n$ or fewer dice.

\begin{align}

F_N(n) = \sum_{k=0}^{n} f_N(k)

\end{align}

This is the cumulative distribution function (CDF), which is plotted in Fig. 2.

Fig. 2: Memoir '44 cumulative probability of unit elimination |

We could also compute this probability by looking at the previously discarded binomial distributions of the number of hits generated with $n$ dice. For each number of dice rolled, we get a separate distribution, $H_n \sim B(n,p)$, where $H_n$ are a set of random variables that each have a binomial distribution, $B(n,p)$.

\begin{align}

f_{H_n}(h) = \binom{n}{h} \cdot p^h \cdot (1-p)^{n-h}

\end{align}

To get the probability of elimination with $n$ or fewer dice, we can sum these binomial distributions across the number of hits, $h$, from the numbers of figures, $f$, to the maximum possible, $n$.

\begin{align}

F_N(n) &= \sum_{h=f}^{n} f_{H_n}(h) \\

&= \sum_{h=f}^{n} \binom{n}{h} \cdot p^h \cdot (1-p)^{n-h}

\end{align}

The result of this alternate calculation is plotted in Fig. 3, which appears indistinguishable. While these must be equal as they are calculations of the same probabilities, I have not shown here that the equations match. I leave it as an exercise to the reader to do this or prove me wrong.

Fig. 3: Memoir '44 cumulative probability of unit elimination from alternate calculation |

Unfortunately, even with the CDF, we're still left with a distribution. While it's more likely for an artillery unit to be eliminated with very few dice, once we've invested 6 dice in attack the artillery is the most likely to remain standing, followed by armor and finally infantry.

What if we were to look at the average endurance of each unit. What is the expected number of dice to eliminate each? Equivalently: what is the expected value of $N$? The expected value of a random variable is a weighted average of all possible values. For our case of a discrete-valued random variable, we find the expected value, denoted with an $\mathbb{E}$ prefix to the left of the random variable, is given by the following equation.

\begin{align}

\mathbb{E} N = \sum_n n \cdot f_N(n)

\end{align}

Here, we know something about the possible values of $n$, so we can specify the range of the sum, instead of simply summing over all integers.

\begin{align}

\mathbb{E} N = \sum_{n=f}^\infty n \cdot f_N(n)

\end{align}

A useful way to calculate this for non-negative random variables is the following equation.

\begin{align}

\mathbb{E} N = \sum_{n=0}^\infty P(N > n)

\end{align}

We're getting long in the tooth, so I'll just note that there's some discussion of it here. Note that $P(N>0$ is related to the CDF.

\begin{align}

P(N > 0) &= 1 - P(N \leq 0) \\

&= 1 - F_N(n) \\

\mathbb{E} N &= \sum_{n=0}^\infty 1 - F_N(n)

\end{align}

This is an infinite sum, but we can look at what the running sum looks like as we increase the range of the summation. That is, we can look at the following sum as $n_\text{max}$ increases.

\begin{align}

\widehat{\mathbb{E} N} &= \sum_{n=0}^{n_\text{max}} 1 - F_N(n)

\end{align}

A plot of this for $n_\text{max} \in {1, 2, 3, \cdots 100}$ is shown in Fig. 4. We can see each value clearly approaching a limit, as calculated below for $n_\text{max} = 100$.

\begin{align}

\widehat{\mathbb{E} N_\text{infantry}} & \approx 7.000000000000002 \\

\widehat{\mathbb{E} N_\text{armor}} & \approx 7.999999999999932 \\

\widehat{\mathbb{E} N_\text{artillery}} & \approx 10.999998659711212 \\

\end{align}

These certainly look like the following are true.

\begin{align}

\mathbb{E} N_\text{infantry} & = 7 \\

\mathbb{E} N_\text{armor} & = 8 \\

\mathbb{E} N_\text{artillery} & = 11

\end{align}

They even tend to follow the formula $\mathbb{E} N =f/p - 1$. However, as we haven't done the math, we don't know for sure. As it's a holiday, I'll leave it here for now.

Fig. 4: Estimating expected value with finite sum |

## No comments:

## Post a Comment