Probability for N dice and list of different matches

JohnStabler

New member
Joined
Aug 14, 2017
Messages
2
Hi,


I've seen similar problems stated in various places on the web, but not my exact problem. I'd be grateful for any help.


I'm developing a card game where players need to roll a certain number of dice and match numbers (or ranges of numbers) on cards. For example a card says the player rolls 5 dice and needs to roll one (6) and one (5 or 6). Another example would be the player rolls 6 dice and needs to get three (3 or 4).


I need to calculate the probability of a successful roll given any number of dice and specifying winning matches. This seems to be made more difficult by the allowing matches to be multiple sides of the dice.


I would like to write a code function so if you pass the number of dice and a list of integers (each integer is the number of sides that would match) then it would return the probability.


Thanks in advance,
John
 
We're not a consulting service. If you would like to explore the mathematics of your game, that will be fine. Please start with your efforts.
 
Sure, although my efforts aren't getting close.

For a given example of 6 dice and I want to calculate the probability of rolling one 6 and a (5 or 6) I thought I'd calculate the number of combinations and divide that by all possible combinations. So I got:

(1 x 2 x 6 x 6 x 6 x 6) / (6 ^ 6)

However, I'm not sure that is the right way of calculating the number of combinations.
 
Sure, although my efforts aren't getting close.

For a given example of 6 dice and I want to calculate the probability of rolling one 6 and a (5 or 6) I thought I'd calculate the number of combinations and divide that by all possible combinations. So I got:

(1 x 2 x 6 x 6 x 6 x 6) / (6 ^ 6)

However, I'm not sure that is the right way of calculating the number of combinations.
That looks right to me: one good outcome for the first slot (being the first die), two good outcomes for the second slot, and six good outcomes (because we don't care) for the other four dice; all divided by the total number of options, which is six for each of the six slots, or 6^6. ;)
 
Top