Sunday, February 12, 2017

Buckets of Dice

Die rolling procedures in wargaming come in many different variations. In the previous blogpost I discussed opposed die rolling. This article focuses on the method that is most commonly known as the “buckets of dice” method.

For those of you for which the name does not ring a bell, the “buckets of dice” method generally refers to rolling a large number of dice – usually D6s – against a target number, and count the number of successes in order to resolve combat. This method is found in many wargaming rules, but the best known ruleset that makes use of it is without doubt Warhammer. But also historical rulesets such as Black Powder or Lion Rampant employ the buckets of dice method.

Often, the method requires several die rolls in succession. E.g. one player might roll 12 dice, requiring a target number to hit. Subsequently, the defender tries to “save” the hits by rolling versus another target number. Some rulesets even require three successive die rolls. Exact terminology and procedures might of course vary from a ruleset to ruleset.

As with any dice rolling procedure, the buckets of dice method itself does not define a ruleset. It only provides meaning when embedded in the context of a full set of wargaming rules. However, it is still useful to understand the underlying principles of such a procedure, irrespective of any surrounding framework. A good workman must understand his tools, and I think a wargamer, especially when he writes his own set of rules, must understand the inner workings of how dice work.

Before we proceed, let us first discuss some notation. We assume the use of normal six-sided dice. A roll of 5+ means a 5 or 6 is needed to score a “hit” or “success”, a 4+ means a 4 or higher is needed and so on. Similarly, 5- means a roll of 5 or lower is needed. When we roll 10 dice, needing a 3+ to score hits, we will write this down as Bucket(10, 3+). This saves us from writing down repeatedly how many dice we will roll versus what target number.

As for writing down probabilities, and depending on context, we will either use percentage numbers (e.g. 30%) or fractional numbers between 0 and 1 (e.g. 0.3), which are more commonly used for probability calculations.

As a last remark, we will consider everything from the point of view of the player trying to score hits or successes. In most game systems, this is the player trying to resolve an attack. This implies sometimes converting die rolls from “successes” to “fails”. E.g. when a “saving roll” is called for, needing a 5+, this implies the roll is deemed successful for the attacker on a 4-. A sequence in which the attacker needs 3+ to hit on 10 dice, and the defender needs a 5+ to save those hits, is written as Bucket(10, 3+, 4-).

Mathematics

I guess most wargamers understand that if you roll a single die, a target number of 4+ gives you 3 possible successes out of 6 possible results, a target number of 5- gives you 5 out of 6 positive results and so on. The table below summarizes these (rounded) probabilities for scoring a single success on the roll of a single die.

Single D6
1+ or 6-
2+ or 5-
3+ or 4-
4+ or 3-
5+ or 2-
6+ or 1-
% success
6/6 = 100%
5/6 = 0.83
4/6 = 0.67
3/6 = 0.50
2/6 = 0.33
1/6 = 0.17

When we roll multiple dice, things are more complicated. Suppose we roll 12 dice on 5+, how many successes can we expect? What is the probability we will score exactly 4 hits, etc.? Luckily, this branch of probability theory has been studied extensively. The mathematical function that describes such probabilities is called a binomial distribution. This function gives us the probability of scoring a specific number of successes, given the total number of dice rolled, and a probability for scoring a hit on a single die (see table above). We will not explain the full formula here, but the interested wargamer is referred to the appendix. Alternatively, one can found a lot of information online.

Let’s look at some charts to get an idea how binomial distribution look like in practice. The graph below plots the various outcomes for Bucket(6, 6+). As you can see, there is a 33% probability we will have 0 successes, 40% probability we will score exactly 1 success, 20% chance we score exactly 2 hits, etc. As can be expected, the probability for scoring 5 or 6 successes is almost zero (and too small to visibly plot on this graph). Note also the asymmetric distribution of the possible outcomes, with the event of scoring exactly 1 success being the most likely to occur.

Probability distribution of number of successes for Bucket(6, 6+)

A similar pattern is observed when the target number is kept at 6+, but we increase the number of rolled dice from 6 to 12. The plot below shows the distribution for Bucket(12, 6+):

Probability distribution of number of successes for Bucket(12, 6+)

When we increase the target number from 6+ to 4+, we expect more hits to occur, but we should also see a symmetric distribution since the chance for success and failure are both 50%. The graph below shows the distribution for Bucket(12, 4+):

Probability distribution of number of successes for Bucket(12, 4+)

Although such graphs provide us with a lot of data, it is a bit daunting to get a good grip on the variety of numbers. It is therefore easier to use of a more concise metric to characterize the possible outcomes of a binomial distribution. Two characteristics typically used are the mode and the expected value.

The mode is the number of successes that have the highest probability of occurring. For Bucket(12, 6+) the mode equals 2, for Bucket(12,4+) the mode equals 6, as can be immediately seen from the graphs above. It is not so that the mode will occur in more than 50% of the cases (a common misconception), but rather that of all possible outcomes (0 hits, 1 hits, 2 hits, …), the mode is the most frequent occurrence.

For the buckets of dice method, the mode can be computed by multiplying the number of dice + 1 by the probability of scoring a hit on single die, and then rounding down. Thus, for Bucket (10, 5+), we multiply 11 (10+1) by 2/6 = 3.67; rounding down results in 3 being the mode. Note that for a low number of total dice rolled, or for a low probability, the mode can possibly be equal to 0. There is one caveat, which happens when the result of the multiplication before rounding down produces exactly a whole number. In this case, the computed mode, as well as the mode - 1 both have the highest chance of occurring. E.g. the mode of Bucket(11, 5+) is both 3 and 4.

The expected value is a more fine-grained characterization of the buckets of dice method and expresses the average number of successes we can expect. As an example, consider Bucket(10, 5+) which might yield anything from 0 and 10 successes. If we would repeat Bucket(10, 5+) many times, and compute the average number of hits we score over many tries, we end up with the expected value. Alternatively, the expected value is computed by multiplying the total number of dice by the probability of a single success. For Bucket(10,5+) the expected value is computed as 10 times 2/6 = 3.33. This is not a whole number and perhaps a bit counterintuitive. After all, we will never score exactly 3.33 successes.

A good analogy to understand the difference between the mode and the expected value is by looking at the average number of children in a typical family, which equals 1.7 for many Western European countries. There is of course not a single family with 1.7 children, but this is simply the result of tallying all children and dividing by the number of families. However, families with 1 child are the most numerous, and therefore, 1 is the mode.

As a further illustration, the following table gives the mode and expected value (in brackets) for rolling 4, 8, 12 and 16 dice vs. various to-hit probabilities:

2+
3+
4+
5+
6+
4 dice
4 (3.33)
3 (2.67)
2 (2.00)
1 (1.33)
0 (0.67)
8 dice
7 (6.67)
5 and 6 (5.33)
4 (4.00)
2 and 3 (2.67)
1 (1.33)
12 dice
10 (10.00)
8 (8.00)
6 (6.00)
4 (4.00)
2 (2.00)
16 dice
14 (13.33)
11 (10.67)
8 (8.00)
5 (5.33)
2 (2.67)

For the buckets of dice method, the mode and the expected value differ by at most by 1. Therefore, both numbers equally give us a good idea of the nature of the distribution and the number of successes we can expect.

Successive buckets of dice

Often, wargaming rulesets require a succession of buckets of dice. A typical example consists of first rolling a number of dice as a “to-hit” roll, then rerolling the number of successes as a “to-save” roll. What can be expected in terms of successes for such a combined procedure? Again, mathematics comes to our rescue. The global behaviour of a succession of buckets of dice is itself a binomial distribution, with a probability for success equal to all separate probabilities multiplied.

Let’s use an example to clarify this. Suppose Bucket(12, 5+) is our “to-hit” roll, followed by a 4- saving roll (remember we look at this from the point-of-view of the attacker). This is equivalent to a single binomial distribution using 12 dice with a probability of 0.33 x 0.67 = 0.22 for success. The mode of such a distribution is 2, and the expected value equals 2.67.

This mathematical trick makes it very easy to compute the mode for successive buckets of dice procedure. The table below shows the resulting modes for 12 dice (and again showing the expected value in brackets), for two consecutive rolls:

12 dice
2+
3+
4+
5+
6+
2+
9 (8.33)
7 (6.67)
5 (5.00)
3 (3.33)
1 (1.67)
3+
7 (6.67)
5 (5.33)
4 (4.00)
2 (2.67)
1 (1.33)
4+
5 (5.00)
4 (4.00)
3 (3.00)
2 (2.00)
1 (1.00)
5+
3 (3.33)
2 (2.67)
2 (2.00)
1 (1.33)
0 (0.67)
6+
1 (1.67)
1 (1.33)
1 (1.00)
0 (0.67)
0 (0.33)


A useful insight is that the order in which the dice are rolled does not matter. Thus, you could as well roll the “to-saves” first, then the “to-hits”, and the overall statistical behaviour remains identical. Whether this makes sense within the terminology and intuition of the ruleset in use is a different matter, but from a pure mathematical point of view both procedures are exactly equivalent.

An identical analysis can be made for 3 consecutive buckets of dice. Warhammer typically uses a to-hit roll, a to-wound toll and finally a saving throw. Suppose that for a specific attack we roll 15 dice, and that the to-hit roll requires a 3+ to hit (0.67 probability). The to-wound roll requires a 4+ (0.50 probability), and the saving throw is at 6+ (0.83 probability success for the attacker). The combined multiplied probability equals 0.28, resulting in a mode of 4 and expected value of 4.16. Again, the order in which the die rolls are made is irrelevant.

As a consequence of the order in which the rolls are made not being important, a good practice is that in a succession of buckets, one could roll the dice versus the most difficult target number first. This will result in fewer dice to be rolled during the second roll, and might speed up dice counting and gameplay. Thus, if you need to roll versus 2+ and subsequently against 6+, consider reversing the target numbers. The statistical outcome will remain identical, but fewer dice are needed during the second roll.

Modifying the target numbers

Changing the target number by a series of +1 or -1 modifiers is the most common way to adjust for cover, weapon types, tactical situations, etc. A +1 or -1 results in an increase or decrease of the probability 1/6 or 17%. Some unexpected rounding effect might happen, but roughly speaking, we can expect that the mode goes up or down by 1 for every multiple of 6 dice and for each “click” by +1 or -1.

When considering a succession of buckets of dice, the effect will be further reduced since the 0.17 alteration is further multiplied by the probability of the other dice rolls. Let’s take an example of 3 consecutive rolls, scoring successes on 3+, 4+ and 3+. For 12 dice, the mode equals 2. Suppose the first roll has a +1 modifier, resulting in target numbers 2+, 4+ and 3+, now with a mode of 3. Although one tends to think the +1 modifier is a big deal when throwing 12 dice, the mode only goes from 2 to 3. Moreover, it does not matter that much on which of the three rolls the +1 modifier is applied. Suppose the modifier is applied to the 2nd roll. The target numbers now are 3+, 3+ and 3+. This gives also a mode of 3. Applying the modifier to the last roll results in a sequence of 3+, 4+, 2+ with a mode of again 3.

I have to admit I choose a set of numbers in such a way that applying a modifier did not have a major effect on the mode, but the example is typical. You might work through some examples by yourselves.

However, specifying different modifiers towards different rolls, each with their own terminology and flavour, can add significantly to the game design. But the actual effect on the expected numbers is most likely identical, irrespective whether you modify the 1st, 2nd or 3rd die roll in the sequence.

The latter implies that there is some latitude when defining a set of modifiers. As a rule of thumb, modifiers defined by the status of figures should be applied to dice rolls made by the player controlling those figures. A figure in cover that is shot at should get a positive modifier on his to-save roll, rather than applying a negative modifier to the to-hit roll. In the same manner, modifiers that depend on the range of fire, should be applied to the attacker’s roll, not to the defender’s roll. When players only have to check the status of their own figures, time is saved and the game flows faster.

Altering the number of dice

Another type of modifier is altering the number of dice. Some rules prescribe the number of dice as a function of distance for ranged fire; other rules might specify the default number of dice to be divided by 2 or 3 depending on situations such as cover or movement.

In any case, the effect on the number of hits we can expect is easy to see, since both the mode and expected value scale linearly with the number of dice: half as many dice roughly means half the mode, and half the number of expected successes.

Both type of modifiers (die roll modifiers or number of dice) can work in the context of game design. But I do think it is bad practice to mix them both. A ruleset that changes the number of dice depending on range, but then also modifies the target numbers on those rolls, is bad design. Either modify the number of dice, or the target numbers, but not both. A single set of coherent modifiers is much easier to remember for players, and mixing them all up leads to excessive consultations of the summary sheet or even worse, the rulebook.

Conclusion

Let's conclude with a summary of the good practices when designing your own buckets of dice procedures:
  1. Modifiers should be applied to the die roll made by the player controlling those figures that trigger the modifier;
  2. Either modify the number of dice, or the target numbers needed for success, but do not mix both in the same set of rules;
  3. If applicable, roll versus the most difficult target numbers first. This will reduce the number of dice in subsequent buckets of dice;
  4. And a last one, for aesthetics: invest in a number of dice, all of the same colour and size. It is much more visually pleasing to the eye when you can roll a handful of dice that look similar. Moreover, if your figures are painted to a high gaming standard, why stick to a crappy set of dice? As with figures and scenery, your dice deserve to be of high (visual) quality as well!
Appendix 1

The binomial distribution Bin(k, n, p) is usually expressed as a function of 3 variables: k is the number of successful events out of a total of n events, and p is the probability of a single event (in our case a die roll) being successful. If we roll 12 dice, with success being scored on 3+, Bin(5, 12, 0.67) then gives us the probability that exactly 5 dice will score 3 or higher.

The full formula is given by Bin(k, n, p) = C(n, k) . p^k . (1-p)^(n-k) with C(n, k) the combinatorial function C(n, k) = n! / k!(n-k)! ; and n! the factorial function n! = n x (n-1) x (n-2) x .... x 2 x 1. p^k is simply p raised to the power k.

As an example, let’s work out Bin(5, 12, 0.67). First we need to compute C(5, 12) = 12!/5!7! which works out to (12 x 11 x 10 x 9 x 8) / (2 x 3 x 4 x 5)= 792. Plugging this result into Bin(5, 12, 0.67) = 792 x 0.67^5 x 0.33^7 = 0.05. Hence, we have a 5% probability of scoring exactly 5 hits when throwing 12 dice and needing a 3+ to score a hit.

Most spreadsheet tools have a built-in function that computes the binomial distribution, so there is no need to program this yourself. Moreover, there are a number of useful apps to be found online that do the same and are able to produce nice graphs and charts.

Appendix 2 (added April 2018)

You can play around with the probabilities of the binomial distribution yourself, by downloading the MS Excel spreadsheet I have used for computing all the values shown in this blogpost. It allows you to alter probabilities, compute expected values, modes, etc.
I have only used this file in MS Excel, so I have no idea whether it works in other spreadsheet programs.

Wednesday, February 08, 2017

Opposed Die Rolls

Wargaming rulesets and rule mechanics come in many different variations, but one of the mechanics that is almost universally accepted is the rolling of dice to resolve actions. Throwing a handful of dice across the table can provide a nice tactile component to the game. Moreover, rolling dice could create tension and help shape the narrative of a game. I guess most wargamers can recollect games in which the fate of the entire battle - at least in their perception - depended on the outcome of a single die roll.

Dice mechanics come in many different variations and flavours: single die rolls, buckets of dice, rolls to beat a target number, the resulting die roll as an index in a chart, the use of polyhedral dice, etc. One of my favourite mechanics is the opposed die roll. This article will delve a bit deeper into the mathematics of opposed die rolls, as well as some good practices on how to use it as a mechanic in your rules of play.

 

D4 versus D12

Opposed die rolls are in essence very simple. Whenever an action between two figures or two units needs to be resolved, both players roll a die. The numerical results are compared and the highest roll is declared the “winner”, with an appropriate result defined within the framework of the rules. Such a mechanism can be used on shooting, melee, morale, …: the usual actions one wants to resolve on the battlefield. Opposed die rolling is obviously not new and has been applied in many different rule sets over the years, if not decades.

The system is most flexible when we allow different types of dice (D4, D6, D8, D10, D12) to be rolled against each other. I realize that there is a cult of wargamers that consider a D6 to be the only proper die type permitted on the gaming table, but the generation of gamers that grew up with Dungeons & Dragons and other roleplaying systems think nothing of using the full array of polyhedral dice. Once you accept that idea, the die type itself can be used to represent a quality metric for a specific characteristic of the unit or figure. E.g. a figure can have a D8 for shooting, a D6 for melee, and a D12 for morale, with the higher die type representing a better ability in that specific characteristic.

The beauty in using a range of different die types is that die modifiers can be implemented not as numbers to be subtracted or added to the rolled result, but as changes of die type. E.g. an action that requires rolling a D8, but has a positive modifier, is upgraded to rolling a D10. As such, you apply the modifier before the die roll, rather than applying a bonus or penalty to the outcome of the roll. That might seem like a gimmick, but is actually very useful and creates a better flow of the game. Indeed, once die types are determined, both players roll their die, compare each other’s results, and can see in the blink of an eye who “wins” the action. There is no need to modify the results after the dice has been rolled. The naked die roll is what you get, with a certain level of excitement and an adrenaline rush when you see the rolled numbers pop up and you immediately know what the outcome of the action is.

Mathematics

Let us first look at some of the mathematics of opposed die rolling. Obviously, you have a higher chance of beating your opponent’s D8 when you roll a D10 instead of a D6, but what exactly are the probabilities?

For anyone who is a bit versed in probability theory, the probabilities are fairly easy to compute with a closed mathematical formula. For those who are not familiar with it, the best thing to do is to count all possible winning outcomes and compare them to the total number of outcomes. Let’s work through an example to show how it can be done. Suppose I roll a D8 versus your D6. I can roll 8 different numbers (each with equal probability), and you can roll 6 different numbers (also with equal probability), for a total of 48 possible outcomes. The table below summarizes all possible combinations that can be rolled. A “W” indicates a win for me, a “L” indicates a loss (or a win for you), and a “D” indicates a draw:

D8 vs D6
1
2
3
4
5
6
1
D
L
L
L
L
L
2
W
D
L
L
L
L
3
W
W
D
L
L
L
4
W
W
W
D
L
L
5
W
W
W
W
D
L
6
W
W
W
W
W
D
7
W
W
W
W
W
W
8
W
W
W
W
W
W

To compute the probability that a D8 wins vs a D6, we count the number of 'W's, giving us 27. Dividing by 48, this gives a 56% for a win. Similarly, we have 15/48 = 31% chance for a loss, and a 6/48 = 13% chance for a draw.

The same exercise can be repeated for other combinations of dice, of which the rounded results are tabulated below. Each entry gives the rounded percentages for a win, a draw and a loss result. E.g. when rolling a D8 vs. a D10, there is a 35% chance of a win, 10% chance of rolling an equal number, and 55% chance of losing. Of course, these numbers are reversed when rolling a D10 vs. a D8 (55% win, 10% draw, 35% loss), as you can see in the table.

(down) vs (across)
D4
D6
D8
D10
D12
D4
38 / 25 / 38
25 / 17 / 58
19 / 17 / 69
15 / 10 / 75
13 / 8 / 79
D6
58 / 17 / 25
42 / 17 / 42
31 / 17 / 56
25 / 10 / 65
21 / 8 / 71
D8
69 / 13 / 19
56 / 13 / 31
44 / 13 / 44
35 / 10 / 55
30 / 8 / 63
D10
75 / 10 / 15
65 / 10 / 25
55 / 10 / 35
45 / 10 / 45
38 / 8 / 54
D12
79 / 8 / 13
71 / 8 / 21
63 / 8 / 30
54 / 8 / 38
46 / 8 / 46

 There are some interesting observations to be made:
  • First of all, as can be expected, the win percentage increases if the attacker’s die is of a better type. However, the exact increments can vary depending on the situation and what dice are involved. 
  • Even when rolling a D4 against a D12, there is still a 13% (1 in 8) chance of winning the die roll. If the draws were counted as favourable for the player rolling the D4, chances of winning would be 21% (1 in 5). Even in this extreme situation, these are fair probabilities that cannot be simply ignored or dismissed as “impossible”. 
  • When rolling dice of equal types versus one another, the win/loss percentages are of course identical, although the chance of rolling a tie is higher with the lower dice types. Hence, the count of a tie towards a win or loss affects low dice types more than it affects higher dice types.

 

Good practices

The above analysis provides us with the raw numbers. It depends on the nature of a specific rules framework how you want to implement opposed die rolling, but a few good practices make this system even more elegant than it already is.

A first recommendation is to use same-coloured dice for each type. All my D8 are yellow, all my D10 are red, etc. This allows for a quick grab of the right die from a pool of dice at hand. Although many gamers can blindly pick a D10 from a heap of dice, there are still many who have trouble doing so and will pick a D8 or D12 instead. However, colours are immediately recognizable and provide an additional visual cue. Many online shops selling dice allow you to specify the colours for individual dice and, in my experience, it’s worth the investment. Five or six dice of each type are enough to have a game running smoothly, without having to waste time looking for that single D8 you happen to own.

A second recommendation is that all bonuses and penalties that depend on the status of your own figure or unit, are applied to your own die roll. Suppose you take a shot at an enemy in cover. As cover affects the status of the defending figure, the defending die roll of the target is promoted by one die type. Technically, we could also apply a penalty on the die type of the shooter. But then, the player controlling the shooter has to ask the player controlling the target whether cover applies or not, whether he has moved or not, and so on. By designing the rules in such a way that each player needs to know just the status of his own figures without having to make detailed inquiries about others’ figures, the game speeds up significantly. Each player rolls his own die and can immediately shout out his result. The winner of the action can be determined quite quickly. Of course, it requires a gentleman’s attitude towards the game to trust one’s opponent in determining and rolling the right die type for his own figure (rather than the need to double-check everything).

But what about the resulting percentages? Looking at the table, we see that either increasing the defender’s die or reducing the attacker’s die does not make much of a difference. As an example, consider a base situation D8 versus D8 and let’s assume the defender is in an advantageous position. Either we increase the defender’s die to a D10, or we decrease the attacker’s die to a D6. The first situation would yield a 35% win for the attacker, while the second situation yields a 31% win. The difference between these percentages is too low to be meaningful in an actual game.


D6
D8
D10




D6
42 / 17 / 42
31 / 17 / 56
25 / 10 / 65
D8
56 / 13 / 31
44 / 13 / 44
35 / 10 / 55
D10
65 / 10 / 25
55 / 10 / 35
45 / 10 / 45





Similarly, if we were to apply a bonus to the attacker or a penalty to the defender, we would end up with either a D10 vs. a D8 (55% win for the attacker), or a D8 vs. a D6 (56% win for the attacker). Again, the differences are negligible.



D6
D8
D10




D6
42 / 17 / 42
31 / 17 / 56
25 / 10 / 65
D8
56 / 13 / 31
44 / 13 / 44
35 / 10 / 55
D10
65 / 10 / 25
55 / 10 / 35
45 / 10 / 45




 

Variations


You can build and expand upon this basic system rather easily:
  • You could expand the dice range even further and include really exotic dice such as a D14, D16, … up to the familiar icosahedral D20. Some specialized dice shops sell these types, although there are not easy to find. On the other hand, such dice are far from familiar and they tend to get confused with each other as they do not have standardized shapes. Moreover, the differences in probabilities between the higher die types tend to get smaller in such a way that the practical influence of these different die types is less outspoken.
  • One could also vary the number of dice. E.g. a positive modifier could imply rolling two dice and take the highest result, or even rolling different types together. However, this would add an additional step when the result of the roll needs to be read out and makes the entire system less elegant, in my opinion. 
  • The same argument can be made for adding numerical modifiers after the dice have been rolled. Although it is a common mechanic in many wargames, I would not combine it with varying die types. Otherwise, you could create confusion in that one type of bonus implies a change of die type, while another type of bonus indicates a change to the rolled number. A good rule set must use elegant game mechanics without adding too many different procedures.

Conclusion 

I fully realize that a mechanic such as an opposed dice roll does not in itself define a set of wargaming rules. You still need to give meaning to the actions that are resolved by rolling the dice. However, I do think it is important that you refine your mechanics in such a way that they become intuitive and easy to use. Moreover, there has to be a full understanding of the underlying mathematical probabilities to prevent the risk that your rules and the plausibility of events happening on your gaming table are not fully comprehended by all players.

Game mechanics also are a matter of taste. If after reading this article you still prefer the buckets of dice method, or swear by using D6s only, please do so by all means. But it can only enrich your understanding of game design when you have at least this knowledge of other methods, along with their good practices. After all, if you only know how to use a hammer, every problem looks like a nail.
 

Addendum (January 2021)

 
I sometimes have received questions about the exact formula for computing the odds of Dx vs Dy. I always answered these in private, also because they seem a bit trivial to me given the method (tabulating all results) described above. But let's give the formula here as well.
 
Suppose x >= y. From the table shown above (D8 vs D6), it's obvious that we have a total of x*y outcomes. These can be divided in 3 groups: a win for Dx, a win for Dy, or a draw.
  • The draw is the easiest: it's the diagonal of the table, and equals y (the size of the smallest die) possible outcomes. Hence the probability is y/x*y = 1/x
  • A win for y (the smallest number) is computed next. Again, when looking at the  table, you can see the number of outcomes equals 1 + 2 + 3 + ... + (y-1). That can be written in a closed formula as y*(y-1)/2. Thus, the probability of this happening equals y*(y-1) / 2*x*y = (y-1) / 2*x
  • A win for x can be computed in a similar way: 1 + 2 + ... + (y-1), but we also have to add the block of outcomes for which Dx rolls guaranteed higher than Dy. That's a number of outcomes equal to (x-y)*y. The total number of outcomes for a win for Dx is thus: y*(y-1)/2 + (x-y)*y = (2*x*y - y - y*y)/2; end hence the probability equals 1 - (y+1) / 2*x

Sanity check: adding all probabilities should result in 1:

1/x + (y-1) / 2*x +  1  - (y+1) / 2*x  = 1.