PDA

View Full Version : Dice comparison formula



EggKookoo
2016-05-08, 12:38 PM
Hi, I'm trying to determine a process for calculating the likelihood of one die roll beating another.

Example: Player A rolls 1d4. Player B rolls 1d6. What's the likelihood that Player B's result will be higher than Player A's? Is this a ridiculously complex problem or is it pretty straightforward?

Heian
2016-05-08, 01:12 PM
Prob(1d6>1d4)=1/3+(3+2+1)/24 = 7/12~58.33333%

Knaight
2016-05-08, 01:16 PM
Hi, I'm trying to determine a process for calculating the likelihood of one die roll beating another.

Example: Player A rolls 1d4. Player B rolls 1d6. What's the likelihood that Player B's result will be higher than Player A's? Is this a ridiculously complex problem or is it pretty straightforward?

The lazy way to do this is with anydice (http://anydice.com/). You want to type the following.

1dN-1dM, where N and M are replaced with die sizes. View in Table and At Least modes, and you can see the odds of beating the roll. View in Table and Normal, and you can get the probability of a tie, plus the chance of beating it by different values.

For the 1d6-1d4 example, the probability is 58.33% (which is slightly different than the 58.833 reported above, which is a typo).

The less lazy way is to look at the numbers on the higher die, and weight them by how often they appear and how often they are bigger than the lower die. That's what's behind the math in the post above. So, take the d6:
6: Always higher than d4. (1/6 chance)
5: Always higher than d4. (1/6 chance)
4: Higher than d4 when rolling a 3, 2, or 1. (1/6*3/4 chance)
3: Higher than d4 when rolling a 2 or 1. (1/6*1/2 chance)
2: Higher than d4 when rolling a 1.(1/6*1/4 chance).

Heian
2016-05-08, 01:22 PM
Regarding a more "general" formula, it's not incredibly complex to figure it out (but I might be wrong).
Regretfully, I'm writing from my phone and Android and mathematical expressions do not love each other!
I'm confident you'll find other playgrounders (is this a word over here?) that can answer you thoroughly.

Knaight
2016-05-08, 01:26 PM
Regarding a more "general" formula, it's not incredibly complex to figure it out (but I might be wrong).
Regretfully, I'm writing from my phone and Android and mathematical expressions do not love each other!
I'm confident you'll find other playgrounders (is this a word over here?) that can answer you thoroughly.

The algorithm above does that. However, if you want to get it done quickly, there's another formula that does it. Lets call the dice N and M, respectively. The probability that 1dN is greater than 1dM when N is greater than M is:
(N-M)/N+(M2-M)/(2NM)

If N is less than M, it's just (M2-M)/(2NM).

The problem is that once you start getting really general, the math gets ugly fast. Something like the odds of 43d10 beating 108d4 is a pain to calculate by hand. Hence, anydice.

EggKookoo
2016-05-08, 01:39 PM
Thanks everyone, this is perfect!

Heian
2016-05-08, 01:44 PM
Knaight, it seems you were faster, anyway here's my answer (probably wrong given that I have serious problems doing math without a pen and some paper).

Hypothesis: N>=M
Prob(1dN > 1dM) = (N-M)/N + (M-1)/(2*N)
Prob(1dN = 1dM) = 1/N
Prob(1dN < 1dM) = (M-1)/(2*N)

EggKookoo
2016-05-08, 05:41 PM
Just to make sure I understand, if it's a contest between 1d6 and 1d4, the chance of the 1d6 meeting or beating the 1d4 is 75%?

ThePurple
2016-05-08, 08:31 PM
Just to make sure I understand, if it's a contest between 1d6 and 1d4, the chance of the 1d6 meeting or beating the 1d4 is 75%?

Yes.

The simple way to demonstrate the math for it is to just analyze what happens on each possible die roll (brute force method, basically).

On a d4 roll of 1, any roll on the d6 will beat it, so it has a 6/6 chance of meeting or beating.

On a d4 roll of 2, anything except for a 1 on the d6 will beat it, so it has a 5/6 chance of meeting or beating.

On a d4 roll of 3, anything except for a 1 or 2 on the d6 will beat it, so it has a 4/6 chance of meeting or beating.

On a d4 roll of 4, anything except for a 1, 2, or 3 on the d6 will beat it, so it has a 3/6 chance of meeting or beating.

All you have to do to find the total chance is combine all of those percentages: (1/4) * (6/6) + (1/4) * (5/6) + (1/4) * (4/6) + (1/4) * (3/6) = 75%.

This is basically what all of the other formulae are doing, except in a much more efficient manner.

Knaight
2016-05-09, 04:50 AM
Knaight, it seems you were faster, anyway here's my answer (probably wrong given that I have serious problems doing math without a pen and some paper).

Hypothesis: N>=M
Prob(1dN > 1dM) = (N-M)/N + (M-1)/(2*N)
Prob(1dN = 1dM) = 1/N
Prob(1dN < 1dM) = (M-1)/(2*N)

This looks fine to me, and your first one is actually a simplified version of what I wrote, which makes it a touch more usable (the third is also a simplified version of what I wrote, phrased differently). I'd probably even use these in lieu of anydice, although that tool is coming back in as soon as a case where more than 1 dN or dM shows up.