Hammer of Math: The Single Die Re-Roll

This week’s Hammer of Math is a quick one, and takes a look at the optimal strategy for using abilities where the model can re-roll a hit or wound roll in 40k.

Both the new Custodes and T’au feature abilities which the player is given the chance to re-roll one hit or wound result in an attack sequence. Based on conversations within Goonhammer there are two schools of thought on what the best strategy is for using this system.

1. The player saves the roll for the test with the lowest probability of failure. This is based on the understanding that the hit and wound rolls are independent of each other, and therefore the average value will increase the most.
2. The player always re-rolls the first failure they come across, arguing that while the rolls are independent, re-rolling the first failure increases the variability of the end result and increases the chance of extreme result. While the average value may be better over a sufficient sample size, 40k is a game of individual rolls and not a statistically significant data distribution.
Rob: This also reduces the chance that your re-roll will be “wasted,” i.e. you reduce the risk of saving the re-roll for wound rolls and then being unable to use it because every wound roll was successful.

With this in mind, I wanted to answer two questions.

1. It seems reasonable to assume that the first failure strategy has a greater effect on the results for lower pools of dice. At the lowest extreme of a single d6 roll, there is no reason to wait for the lowest probability outcome if you’ve already failed to get there. Is there a point at which the optimal strategy shifts?
2. What is the actual difference in average number and variance of successes between the two strategies?

Method and Results

As much as I like to talk about math, in reality I’m an engineer and tend to brute force my solutions. This case was no different. So I coded up a script to try each method 10,000 times across different combinations of hit, wound, and number of attacks. The values ranged from 1 to 10 attacks, and from hit and wound values ranging from 2+ to 6+. I only looked at scenarios where the wound roll was less than the hit roll, as otherwise the methods would be identical.

There’s no particularly good way to show this much data, so here’s the raw file. S1 is the lowest probability strategy, and S2 is the first failure strategy. The differences in variance and average are S2 – S1, so positive values means that the first failure strategy is higher than the lowest probability method.

AttacksHitWoundS1 AverageS1 VarianceS2 AverageS2 VarianceDiff Avg (S2 - S1)Diff Var (S2 - S1)
1230.8750.1093859390.87890.1064454350%-3%
1240.83520.1376547250.83710.1363772280%-1%
1340.66250.2236161120.67160.2205754981%-1%
1250.78520.1686778280.78910.1664378340%-1%
1350.58770.2423329430.59920.2401833782%-1%
1450.42280.2440645660.41380.242593819-2%-1%
1260.74550.1897487250.74290.1910186920%1%
1360.51580.2497753380.51480.2498059410%0%
1460.33050.2212918790.32790.22040363-1%0%
1560.18250.1492086710.18120.148381398-1%-1%
2231.5940.376801681.60640.3673157721%-3%
2241.38390.4927700671.38310.4981842080%1%
2341.07590.583997591.0720.5882748270%1%
2251.16070.5355290631.15260.538767117-1%1%
2350.83240.5761678570.83430.565700080%-2%
2450.57810.4671471050.57640.4730103410%1%
2260.87180.4774125010.87170.4728863990%-1%
2360.56120.446499210.57250.4457883292%0%
2460.34290.3185514450.34460.3178826280%0%
2560.19490.1907330630.2020.1984158424%4%
3232.24560.7079514352.25460.7042492650%-1%
3241.85280.8700191621.86340.8678272231%0%
3341.42720.9033904991.40330.910540164-2%1%
3251.40270.8724199521.4010.8842874290%1%
3351.01080.7961629760.98130.780428353-3%-2%
3450.70880.6070632660.69810.590615452-2%-3%
3260.94750.6510088510.95120.6594845080%1%
3360.60170.5349106010.60490.5472507151%2%
3460.38180.3662653870.39310.3728096713%2%
3560.2260.2173457350.23010.2209760882%2%
4232.82181.0599507552.82211.0785594460%2%
4242.2751.245299532.26271.221210831-1%-2%
4341.72081.1953668971.72031.1649844080%-3%
4251.65621.1215137111.65921.1363689970%1%
4351.18660.9454749871.1930.9582468251%1%
4450.83380.7276503250.8340.7227162720%-1%
4261.03630.7836606761.03350.8068584360%3%
4360.66860.6238364240.68620.6297925393%1%
4460.44660.4199904390.44240.418524092-1%0%
4560.27480.2677117310.28890.2762644165%3%
5233.40091.4005192423.37511.409140904-1%1%
5242.66221.5204432042.65491.5137573660%0%
5342.04061.4000916492.04811.3943258230%0%
5251.87991.3796139511.89441.3639850391%-1%
5351.39751.1308068311.38091.130928283-1%0%
5451.01570.8627397841.01720.8705912190%1%
5261.12130.9392802381.10470.904028313-1%-4%
5360.74550.692198970.73270.675118222-2%-2%
5460.51270.4854872590.51130.4791202220%-1%
5560.32990.310297020.33680.315197282%2%
6233.98871.6917414843.97511.7028502750%1%
6243.06741.8426415043.03831.797412851-1%-2%
6342.35991.6183338232.33781.646455806-1%2%
6252.12791.562297822.13551.55549530%0%
6351.59321.2834421041.59541.2308219220%-4%
6451.17641.0101840581.16941.018805521-1%1%
6261.20441.0237230121.20351.0141891690%-1%
6360.83550.7525150020.84030.7756734771%3%
6460.60540.5593467750.58060.535157156-4%-4%
6560.39560.3825388940.38230.357982508-3%-6%
7234.49661.9929877394.50362.0389909390%2%
7243.44792.0574913393.47382.0905226121%2%
7342.65931.8290064112.69871.849303241%1%
7252.3741.751899192.39531.7910170121%2%
7351.80351.4134290931.77621.406054165-2%-1%
7451.32641.1015731971.35391.1283676272%2%
7261.29811.1363500251.29361.1521142510%1%
7360.91690.8134757380.91390.8375705470%3%
7460.66090.6101722070.66750.6180055511%1%
7560.44380.4198835480.44660.4163900791%-1%
8235.06152.3049482455.08132.2857188820%-1%
8243.82662.3271651573.83912.3190430940%0%
8343.01282.0396401243.01122.0878833480%2%
8252.62381.9438679472.61771.9213388440%-1%
8352.03591.5807692672.02721.5942195820%1%
8451.51361.2823432741.49791.271522742-1%-1%
8261.41211.224996091.40871.2607903890%3%
8361.03190.9443768281.01230.918240534-2%-3%
8460.75350.6822059710.76360.7001850591%3%
8560.48730.4696856790.50740.4809933394%2%
9235.6152.5992349235.61192.5231307030%-3%
9244.21832.53989914.25762.599102151%2%
9343.34622.2751730773.33842.2169071310%-3%
9252.882.1606160622.86992.1361876090%-1%
9352.23071.7522527352.21821.719960756-1%-2%
9451.67421.3957939391.65881.368719432-1%-2%
9261.54461.3577466151.52761.349773217-1%-1%
9361.1291.0346624661.1130.992530253-1%-4%
9460.84280.7673648960.85210.782503841%2%
9560.56640.5368447240.54870.517680078-3%-4%
10236.17162.7902324636.15012.7570456950%-1%
10244.632.8297829784.64912.7690460950%-2%
10343.6712.436602663.67892.4688416740%1%
10253.11592.316898883.1312.3402730270%1%
10352.44491.8813521252.4611.9064696471%1%
10451.84161.5536648061.82181.50579534-1%-3%
10261.66671.4795590661.63431.473110821-2%0%
10361.21991.0688508751.23681.0976355241%3%
10460.91340.8463850790.91980.8326512251%-2%
10560.6040.5716411640.61660.5896634062%3%

The first thing we can do is look at the baseline level of variability between the two methods using the single attack results. Since the single attack is only one D6, the results should be identical and any variation should be attributable to an external factor. We see that the difference in mean results ranges from +2% to -2%, so we can assume any difference less than that is meaningless.

What about the differences beyond that? On average there is no difference; the mean in terms of difference in average number of successes and variation in the number of successes is effectively zero. From a qualitative perspective it looks like the highest levels of deviation in the mean correlate with the lowest wound roll probabilities, which make sense given that for so few successes the results can vary a lot.

Sources of Error

If I had to guess, I’d say if there is an error these are the most likely culprits: