PDA

View Full Version : Probabilities and exploding dice.



Oddgamer
11-07-2015, 07:06 AM
I have a game system and need to work out some probabilities. Two dice are rolled, not necessarily with the same number of sides. Consider a d4 and a d10 for our example. If a die rolls its maximum it 'explodes'. That is, it rolls again and adds this to the total. I can do this indefinitely. So, for example, the d4 might get a total of 15 by rolling 4, 4, 4, 3. A d10 could do so with rolls of 10, 5. If the total of both rolls is 1, this is a Bad Thing, and the odds of this happening are fairly clear (in our example, 2.5% of the time, 25% for the d4 x 10% for the d10).
If it's not 1 on both rolls, then the higher roll is taken. So if the d4 rolls a 3 and the d10 rolls a 1, the result is 3. If the d4 rolls a 12 and the d10 rolls 11, it's 12. But at this point I don't know what the odds of rolling exactly 2 are, or exactly 3, or 4, or 12, or 22. I don't know how to figure that out. The probabilities of at least X would then be a simple matter of the 100-(Probability of X-1). But how do I figure out what the odds of getting exactly each of those numbers is?

Running a small program without the exploding dice (which is easier), I find that the values are as follows:
1 - 2.5%
2 - 7.5%
3 - 12.5%
5 - 17.5%
6 - 10%
7 - 10%
8 - 10%
9 - 10%
10 - 10%

I can't figure out how to get those numbers, either (without running through all possibilities, which I can't do with the exploding dice).

pka
11-07-2015, 09:46 AM
I have a game system and need to work out some probabilities. Two dice are rolled, not necessarily with the same number of sides. Consider a d4 and a d10 for our example. If a die rolls its maximum it 'explodes'. That is, it rolls again and adds this to the total. I can do this indefinitely. So, for example, the d4 might get a total of 15 by rolling 4, 4, 4, 3. A d10 could do so with rolls of 10, 5. If the total of both rolls is 1, this is a Bad Thing, and the odds of this happening are fairly clear (in our example, 2.5% of the time, 25% for the d4 x 10% for the d10).
If it's not 1 on both rolls, then the higher roll is taken. So if the d4 rolls a 3 and the d10 rolls a 1, the result is 3. If the d4 rolls a 12 and the d10 rolls 11, it's 12. But at this point I don't know what the odds of rolling exactly 2 are, or exactly 3, or 4, or 12, or 22. I don't know how to figure that out. The probabilities of at least X would then be a simple matter of the 100-(Probability of X-1). But how do I figure out what the odds of getting exactly each of those numbers is?

Running a small program without the exploding dice (which is easier), I find that the values are as follows:
1 - 2.5%
2 - 7.5%
3 - 12.5%
5 - 17.5%
6 - 10%
7 - 10%
8 - 10%
9 - 10%
10 - 10%

I can't figure out how to get those numbers, either (without running through all possibilities, which I can't do with the exploding dice).
Look at the Platonic Solids (https://en.wikipedia.org/wiki/Platonic_solid#Cartesian_coordinates). There there are none with 3, 5, 7,9,10, or 11 sides. It impossible to construct a fair "number cube" with those values. Therefore, you have a very difficult with the probabilities.

Oddgamer
11-07-2015, 10:26 AM
Look at the Platonic Solids (https://en.wikipedia.org/wiki/Platonic_solid#Cartesian_coordinates). There there are none with 3, 5, 7,9,10, or 11 sides. It impossible to construct a fair "number cube" with those values. Therefore, you have a very difficult with the probabilities.

I'm not entirely certain what you are saying. My guess is that you're having problems with the probabilities I was suggesting for the various roll results on the dice. If that's not the case, please explain, but if it is here's how it works.


A four sided die (d4) can have values 1, 2, 3, or 4. A d10 can have values 1 to 10. In combination they can generate 40 possibilities, from 1 1 to 4 10. Of those 40 possibilities only one, 1 1, leads to a result of 1 when taking the highest roll. 1/40 = 0.025, or 2.5%. Getting a 1 shows up 2.5% of the time. Getting a 2 can show up three ways, 1 2, 2 1, or 2 2, all of which give 2 as a result. This happens, then, 3 times out of 40. 3/40 = 0.075, or 7.5% of the time.


The rest of the probabilities were calculated in this same brute-force method of checking every possible combination, which is something I _can't_ do with exploding dice because there's no definite limit to the maximum values.

Ishuda
11-07-2015, 01:35 PM
...I can't figure out how to get those numbers, either (without running through all possibilities, which I can't do with the exploding dice).
Nothing to it but to do it. First of all, you need a given probability for each outcome for each die. For example you could say they were both fair die and then the outcome for the d4 and d10 die would be 0.25 and 0.10 respectively. Then you start building a table.

Assuming fair dice, lets do d4 first:
1: 0.25
2: 0.25
3: 0.25
5=4, 1 (one four and then a 1): 0.25*0.25 = 0.252
6=4, 2: 0.252
7=4, 3: 0.252
9=4, 4, 1 (two fours and then a 1): 0.25*0.25*0.25=0.253
10=4, 4, 2: 0.253
11=4, 4, 3: 0.253
...
So the probability of getting 4n+j; n=0,1,2,...; j=1, 2, 3 is 0.25n+1
Notice that the total sum S can be written as
S = 3 \underset{k=1}{\Sigma}\, 0.25^k
= 3 [\frac{1}{1-0.25}\, -\, 1]
= 1

In a similar fashion, for a fair d10 dice we have the probability of getting [EDIT: fix dumb mistake] 10m+k; m=0,1,2,...; k=1, 2, 3, ..., 9 is 0.10m+1

Now continue.

Oddgamer
11-08-2015, 01:30 AM
Notice that the total sum S can be written as
S = 3 \underset{k=1}{\Sigma}\, 0.25^k
= 3 [\frac{1}{1-0.25}\, -\, 1]
= 1

I don't know how to use this to work out the probability of getting a 5, for instance. I can work out the probability you describe for getting a 5 on a d4 (.252), and on a d10 (.1), but I'm not sure how to get from there to the odds on either result happening.
Some searching online suggested that the probability P(A or B) when they are not mutually exclusive is P(A) + P(B) - P(A and B), but this doesn't work. The expected result there would be 0.15625, but doing a brute force roll check by computer says the result is somewhere near .10617.
You mentioned the sum of probabilities leading to 1... I don't know where to go with that. When I said I couldn't run through all the possibilities, the problem comes when the die explodes. On a single d4 there's 1 way for each of 1, 2, 3, and 4 to show up, and with an exploding die there's only one way for 5, 6, 7 to show up, too, but this wouldn't make the 'number of possibilities' for a single explosion 8 as the chances of getting 1, 2, 3 should be much higher than 5, 6, 7. Thus I can't use my method of trying all the roll combinations and seeing how often any particular number shows up, which is what I was doing.
Even looking at it without the exploding dice, it should be possible to work out the odds based on the probability of each number happening (and possibly the odds of prior numbers). That is, if the dice don't explode then without knowing that d4 and d10 lead to 40 possible results, there should be some way to determine from the fact that 4 shows up .25 on the d4 and .1 on the d10 that the chances of getting a 4 by taking the higher of the two is .175. I think this has to do with the sum thing you mentioned, but as I said I have no clue where to go with that, where to even look for the answer. I don't know what the question is called.

Oddgamer
11-10-2015, 07:02 AM
Solved, I think. Answer is as follows:
For the d10 the odds on getting any number up to 9 is 0.1. Then 0.01 for 11 to 19, and so on. This is the d10p.
For the d4 the odd on getting any number up to 3 is 0.25. Then 0.0625 for 5 to 7, and so on. This is the d4p.

d10n is the sum of all probabilities of values from 1 to N. So in the case of 5, d10n = 0.5 (0.1 + 0.1 + 0.1 + 0.1 + 0.1).
d4n is the sum of all probabilities of values from 1 to N. So in the case of 5, d4n = 0.8125 (.25 + .25 + .25 + .0625).

(d10p x d4n) + (d4p x d10n) - (d4p x d10p) = probability of that number.
So in the case of 5, (.1 x .8125) + (.0625 x .5) - (.1 x .0625) = .08125 + .03125 - .00625 = 0.10625. This is close to experimental value.

In the case of 4, d10p = .1, d4p = 0, d10n = .4, d4n = .75. d4p being 0 eliminates everything except d10p x d4n = .075. Again close to experimental value.
In the case of 10, d10p = 0, d4p = 0.015625, d10n = .9, d4n = 0.96875. dp10 being 0 eliminates everything except d4p x d10n = .0140625. Again close to experimental value.

Is this correct?