# Difficult Probability Question

#### StyrofoamK

##### New member
I have been working on this problem for weeks, and have enlisted some of my more math oriented friends, but do not know the solution. Without further adieu, here is the problem:

Picture a game that uses a combat system similar to the one used in Risk in that each player rolls a given number of dice and compares a subset of the highest values that turn up to see whether/how much damage is inflicted. There are similarities and differences, however. Here are the important contours of the system.

The Premises

1. Instead of using 6-sided dice, the players use 10-sided dice.

2. The number of dice each player rolls is not determined by the quantity of units in each space. Instead, only one unit may occupy each space, and the number of dice is determined by special qualities of each particular unit. The number of dice rolled may be called attack value and defense value.

Example 1: Unit A has an attack value of 6. Therefore, it may attack with 6 10-sided die. Unit B has a defense value of 4. Therefore, it may defend with 4 10-sided die.

3. In Risk, the maximum number of units that can be destroyed is determined by the number of dice being rolled by the player rolling the fewest dice. For example, when attacker rolls 3 dice and a defender rolls 1, the maximum (and minimum, in this case) armies destroyed is 1. That is the total amount of damage that can be inflicted.

Unlike that system, in this game the maximum amount of "damage" that the attacker can inflict (because remember, there is only one unit per space on the board) is determined by the type of attack the attacker uses. This cap on damage can be called maximum damage.

Example 2: As above, Unit A has an attack value of 6. Let us now assume it also has a maximum damage of 3. Also remember that Unit B, as above, has a defense value of 4. In this scenario, Unit A rolls 6 dice and then selects the highest 3 in order from highest to lowest (e.g., 9, 6, 5). Unit B will roll 4 dice, and match the highest 3 in order from highest to lowest (e.g. 10, 6, 4).

4. The defender, as in Risk, wins all ties.

5. In Risk, both attackers and defenders can lose units as a result of the attacker engaging the defender. In this game, only the defender can be harmed by an attack. When a defender is successful, that just means no damage is dealt.
Example 3: As above, the attack value and defense value of the dice that were within the maximum damage were, in the form [A, B]: {9, 10}, {6, 6}, {5, 4}. In the first set, the defender's 10 beats the attacker's 9 and no damage is dealt. In the second set, the defender and attacker tie with 6 each, and no damage is dealt. In the third set, the attacker beats the defender since 5 is greater than 4. Accordingly, the result of this attack is that the defender takes 1 point of damage.

The Question

Create a series of tables, that given the relevant variables (attack value, defense value, and maximum damage) will tell:

1. The expected value (EV) of the attacker's damage (e.g., the attacker will deal an EV of 1.56 damage)
2. The percentage likelihood of each possible outcome (e.g., 0 damage = 10%, 1 damage = 60%, 2 damage = 5%)

I have tried insert a mockup of what the table would look like, but I cannot figure out how to do it. Basically, there would need to be a separate representing maximum damages from 1-10. For each table, the X axis would represent the defense value of 1-15 (number of defense dice), and the Y axis would represent the attack value of 1-15 (the number of attack dice). What I need to do is be able to calculate the probability for each cell. I can easily do 1 dice v. 1 dice, just by brute forcing it. By drawing a 100x100 grid (10-sided dice) and excluding the ties, Attacker and Defender each have 45 squares. Then give the defender the 10 possible ties, and the probability of a successful attack is 45%. Of course, from there it gets significantly harder. In particular, it gets harder because the information I want to know gets more complex.

While for "Max 1 Dmg" the chart can look like the mockup above, for e.g. "Max 2 Dmg" I want more information. This is because with "Max 1 Dmg", the only options are 0 damage or 1 damage, and the output can be represented by a single % value. In contrast, for "Max 2 Dmg" I want to know the probability of (a) 0 damage, (b) 1 damage, (c) 2 damage, and I want to know the expected value of damage inflicted (which will be some decimal, which I want to know to the hundredths place). Accordingly, each cell in the above chart would actually contain multiple values. I would have to merge the numerical cells on the X and Y axis so that where e.g. "3" and "4" intersect, there is a cluster of cells each presenting different information.

It is also more difficult (obviously) because the damage is capped. So where it's 7 attack vs. 5 defense, I don't want to know the probability of each pairing up to 5 (the fewest dice). I want to know, given that the chaff is separated from the wheat, what is the likelihood of possible outcomes where only the top 3 of each players' dice are counted.

Possible Confusions Clarified

1. The defender's Defense Value does not act as a limitation on the Maximum Damage of the attacker.

2. The dice subset within the maximum damage must be paired in order from highest to lowest. That is to say, the defender may not "lowball" the attacker by posting high values compared to the attackers low values, and its low values with the attackers high values to try and split the difference.

If anyone can help me solve this problem, I will be eternally grateful.

#### StyrofoamK

##### New member
Work I've Done

So, here is a sample of what I've done to start answering. I know that posting questions with insufficient work is frowned on here. I'll say upfront that this is pretty far over my head.

I've tried writing out possibilities charts for smaller numbers of dice and dice faces, but even there it gets pretty overwhelming. I'm looking for an algorithm for how larger sets representing the Attack Value (AV) and Defense Value (DV) would map into smaller subsets representing the Maximum Damage (MD) of the attacker with the corresponding probabilities. For example here is a list of all possibilities for AV 3 with three-sided dice.

111
112
122
113
133
123
222
223
233
333

Now consider MD = 2. Here are the possible subsets with corresponding probabilities:

11 : 1/10
12 : 1/10
22 : 2/10
13 : 1/10
23 : 2/10
33 : 2/10

That's the first algorithm that I'll need. The second is even more complicated. Once you can map the AV and DV into subsets with corresponding probabilities, I will need to be able to compare the values of the two. This is going to require some conditional probabilities of the following sort: If subset(AV) = 33, then what is the probability that subset(DV) contains no threes? Only one three? Two threes?

I am not sure where to go from here. This work was done with significant help from a math-y friend, and now I'm stuck. Thanks to anyone who can help.