I'm glad you appreciate this Darcy.

The development team could confirm my numbers by just simulating fights using the game logic thousands of times and averaging damage taken (maybe 100,000 times for my dice=4, their dice=6 just to confirm, 2.83 is the value at more precision). I did not compute them this way so this would be a good exercise if these numbers were being used for development decisions.

In case you have some knowledge of probability theory, I will describe my own approach to producing these numbers which involves identifying the probability distributions for attacks and blocks. This is much more useful than just having an average because it allows computing probabilities of anything. For instance, perhaps it is more useful to know your probability of surviving than the average damage you will take.

**Shields**Let's start with the number of shields your character will get. The first step is determining the chance of a particular starting die resulting in a shield. It is not 1/6 because that is only the chance of initially rolling a shield. We can roll any number of explosions and then a shield. In other words, the probability of rolling a shield = rolling a shield

**or** rolling an explosion and then a shield

**or** rolling an explosion, another explosion and then a shield

**or** ... (infinite possibilities) =

So looking at a single die we have a 1/5 probability of getting a shield (easier to see simply by considering that every initial die must eventually land on a non-explosion and this is the only time you can get a shield... and shields represent 1/5 of possibilities among non-explosion rolls).

Okay so assuming we have n dice, what is the probability distribution of

**# of shields rolled**? This is called a binomial distribution n=# dice, p=1/5. We have n dice and each has 1/5 chance of resulting in a shield, so # of shields is a binomial distribution. In probability theory we have a shortcut for calculating the average for this: np. So in this case that's

**(#dice)*1/5**. This is the average number of shields rolled with n dice.

Refer to this for an explanation of the

Binomial Distribution and notice on the right it says "mean=np". This is what we're using.

**Attacks**This is a much harder problem, but becomes manageable if you break it down the right way. Suns are attacks during the day and moons at night so either way we have two possible non-explosion attack values: sword or the relevant day/night roll. Using the logic above, this makes the distribution for

**# of non-explosion attack rolls** binomial with n=# dice and p=2/5. Hence the average non-explosion attacks is np=

**dice*2/5**What about explosions? We need to count those too. Luckily the non-explosion attack rolls are limited to the number of initial dice at the start of the battle and are completely independent of how many explosion rolls you get. Therefore it is okay to count these separately and add them.

First we need to look at a single initial die and identify the distribution of

**# of explosions resulting from that die**. This is the same as counting the number of failures before the first success having a 5/6 probability (failure = rolling an explosion, success = a non-explosion). This is called a

geometric distribution with p=5/6.

However, that's just the distribution for one initial die. We have n dice and so we're adding n of these distributions. Since the outcomes for each die is independent of the others, we can use a very convenient result: that the sum of n independent and identically distributed geometric random variables is a

Negative Binomial Distribution with r=# dice, p=1/6 (following the wiki convention). Notice on the side it says the mean is pr/(1-p). For us that's dice*(1/6)/(1-1/6)=

**dice/5**So the average total attacks = average non-explosion attacks + average explosion attacks = dice*2/5+dice/5=

**dice*3/5**. (linearity of the expected value is what allows adding the two averages)

**Conclusions**So you might think that the average damage taken (ignoring anything but dice count) is just

but that would only be the average if you count over-blocking as taking negative damage. For instance if your opponent rolls 1 attack and you roll 5 shields that would be averaged in at -4 damage with that calculation.

So the true distribution is:

**max(0,(opponent's # non-explosion attacks)+(opponent's # explosions)-(my # shields))** to count those 0 damage battles correctly.

That is the distribution used to calculate the numbers in the table. Unfortunately the formula for the average of this distribution is a lengthy mess so I calculated the table by running some code. Now that we know the distributions for everything, any probabilities involving battles can be computed.

Note, however, that if you wanted to simultaneously calculate your own attacks and blocks you would have to account for the fact that your number of blocks and attacks are not independent (if you have 5 dice and roll 3 non-explosion attacks, you could have at most 2 shields for instance). The above table is calculating your shields against your opponent's attacks so this is not an issue.

Darcy: I hope that the dev team can benefit from this analysis. Let me know if the team ever confirms any of my numbers.