# The math on different sets of dice. Help a brother out!

8 replies [Last post]
Fruittreeee
Offline
Joined: 07/06/2018

Hey there! First time poster here!
I love working on games and trying to find fun solutions for mechanical problems. However! Maths is hard man! And to balance a game I think maths are needed! So help me out?

If I have three different sets of three d6 each
-One with two hits and four blanks on each die
-One with three hits and three blanks on each die
-One four hits and two blanks on each die

So basically, 33%, 50% and 66% chance of a hit. Right? Right?? I dunno maths man!

Also do the chances increase and decrease when I would remove or add one of the three dice?

My question is this:
What are the odds of getting a hit with one, two or three of the dice in each different set? (Not mixing sets! That would be crazy math! Unless you feel like it ofcourse)

I hope I expressed myself clear enough, if not please tell me :)

Ronnie!

pelle
Offline
Joined: 08/11/2008
Welcome to bgdf! The maths

Welcome to bgdf!

The maths for three identical dice is actually pretty simple in this case, since there are only two possible outcomes (hit or no hit), which means what you have are essentially three coins to flip. You just have to imagine coins that are heavier on one side so not unbiased like coins should be.

If the probability is p (where p for your dice are 0.33, 0.50, and 0.66) of a hit then the probability of 3 hits is p * p * p. 2 hits is 3 * p * p * (1 - p), 1 hit is 3 * p * (1 - p) * (1 - p). (I... think?)

It does get a bit crazy with mixed dice. Several cases to enumerate. Would suggest using something like Lea to calculate it, since computers are better at that stuff than we humans are anyway. (https://bitbucket.org/piedenis/lea)

Jay103
Offline
Joined: 01/23/2018
Fruittreeee wrote:So

Fruittreeee wrote:
So basically, 33%, 50% and 66% chance of a hit. Right? Right?? I dunno maths man!

So far so good.
Quote:
My question is this:
What are the odds of getting a hit with one, two or three of the dice in each different set? (Not mixing sets! That would be crazy math! Unless you feel like it ofcourse)

You're asking about the probability of getting at least 1 hit with two "33" dice? Or 3 "33" dice?

The way to pose that question is to ask the odds of getting NO hits, and then your answer is the opposite.

So the odds of getting no hits with two "33" dice are 2/3 * 2/3 = 4/9 = 0.4444. The odds with three dice are 2/3 * 2/3 * 2/3 = 8/27 = 0.296.

Therefore the odds of NOT getting no hits (i.e. getting at least 1 hit) are 0.5555 and 0.704.

You can do the math for the other two cases :) The "66" die is the reverse of this die, though, so that answer is 0.4444 and 0.296.

If you want to mix dice, you just do this with numbers that are different. If you wanted to roll one of each type, that's just 1/3 * 1/2 * 2/3.

If you wanted something more complicated, like the probability of getting exactly 2 hits out of 3 dice, there's more math involved.

X3M
Offline
Joined: 10/28/2013
Www.anydice.com Explore it a

Www.anydice.com

Explore it a bit.

If I get home. And you need help with that website. Or need someone to double check things. Let me know.

At least 1 hit or exactly one hit are 2 entirely different things. You need the at least function. It will include multiple hits.

Also. Anydice allows for simple custom dice like the ones you described.

pelle
Offline
Joined: 08/11/2008
I tried Lea on this (not the

I tried Lea on this (not the latest version though, and using python 2, so not 100 % the same code as would probably be used with the latest versions).

``` from lea import *```

d1 = Lea.fromValFreqsDict({1 : 4, 0 : 2})
d2 = Lea.fromValFreqsDict({1 : 3, 0 : 3})
d3 = Lea.fromValFreqsDict({1 : 2, 0 : 4})

print d1.times(3)
print
print d2.times(3)
print
print d3.times(3)
print
print d1+d2+d3

Results:
``` 0 : 1/27 1 : 6/27 2 : 12/27 3 : 8/27 ```

0 : 1/8
1 : 3/8
2 : 3/8
3 : 1/8

0 : 8/27
1 : 12/27
2 : 6/27
3 : 1/27

0 : 2/18
1 : 7/18
2 : 7/18
3 : 2/18

This is the same results as my formulas above. Yay! (Except I did not manually calculate the last one that combines one of each type of dice, so that one I just hope is correct.)

pelle
Offline
Joined: 08/11/2008
X3M wrote: If I get home. And

X3M wrote:

If I get home. And you need help with that website. Or need someone to double check things. Let me know.

At least 1 hit or exactly one hit are 2 entirely different things. You need the at least function. It will include multiple hits.

1 hit is 1 hit, so my answers assumed OP was interested in the probability of exactly 1 hit. The values for exact number of hits (as I gave above) are more useful most of the time since you can just add them to quickly calculate various ranges, like if you want to know 1 or more hits or 2-3 hits or whatever.

Jay103
Offline
Joined: 01/23/2018
X3M

X3M wrote:
Www.anydice.com

Explore it a bit.

If I get home. And you need help with that website. Or need someone to double check things. Let me know.

At least 1 hit or exactly one hit are 2 entirely different things. You need the at least function. It will include multiple hits.

Also. Anydice allows for simple custom dice like the ones you described.

That's pretty powerful.

Still, I think it's better to understand the WHY.. at least a little bit. :)

X3M
Offline
Joined: 10/28/2013
pelle wrote:X3M wrote: If I

pelle wrote:
X3M wrote:

If I get home. And you need help with that website. Or need someone to double check things. Let me know.

At least 1 hit or exactly one hit are 2 entirely different things. You need the at least function. It will include multiple hits.

1 hit is 1 hit, so my answers assumed OP was interested in the probability of exactly 1 hit. The values for exact number of hits (as I gave above) are more useful most of the time since you can just add them to quickly calculate various ranges, like if you want to know 1 or more hits or 2-3 hits or whatever.

Agreed.
Having the "at least" option, makes chances for at least 1 hit very high with 3 dice. Regardless of the set.

And uhm...the one you didn't do manually. Is still correct. :)

Interesting precise results. Did you program that yourself? I miss anydice having that option.

pelle
Offline
Joined: 08/11/2008
No, I did not make Lea. It

No, I did not make Lea. It was/is made by one Pierre Denis. I did contact him a few years ago about adding some extra functions to make doing calculations on dice a bit easier and he did so (open source at its best!).

That library does a lot more than just calculating probabilities on dice, which also means that (as you can see above...) sometimes the syntax is much heavier than anydice and you can need a few extra lines of code to do simple things that anydice does automatically. It looks like the new version is a bit more user-friendly though, so I have to look into how that works.