Probability in a dice game

  • B
  • Thread starter Norway
  • Start date
  • #36
anuttarasammyak
Gold Member
1,925
1,006
Following up the post ##32 and #33 I show here counting relevant cases of N(10), N(11), N(12), N(13) and N(14). N(n) is introduced in post #32.

*********************************************************
Is the number of cases we want is written as

14∑n=7 14Cn∗N(n)∑n=714 14Cn∗N(n)​

\sum_{n=7}^{14} \ _{14}C_n*N(n)
where N(n) is the number of cases in game of n dices of five faces,
satisfying 7-of-a-kind or (n-7)-of-a-kind with no redundant count ?
*********************************************************


*************************************
N(10)

##Three\ 3-of-a-kind##

For brevity I introduce < > notation for number of multiset multiset permutation of the case AAABBBCCCD
[tex] <3+3+3+1> = \frac{10!}{3!3!1!}[/tex]
##<3+3+3+1>*5*4 ##... choice D,E

##Two\ 3-of-a-kind##

AAABBBCCCC
##<3+3+4>*5*\ 4C_2## ...choice C,(AB)

AAABBBCCDD
##<3+3+2+2>*5*\ 4C_2## ...choice E,(AB)

AAABBBCCDE
##<3+3+2+1+1>*5*\ 4C_2## ...choice C,(AB)

##One\ 3-of-a-kind##

AAABBBBBBB (*)
##<3+7>*5*4## ...choice A,B

AAABBBBBBC
##<3+6+1>*5*4*3## ...choice A,B,C

AAABBBBBCC
##<3+5+2>*5*4*3##... choice A,B,C

AAABBBBBCD
##<3+5+1+1>*5*4*3## ...choice A,B,E

AAABBBBCCD
##<3+4+2+1>*5*4*3*2##... choice A,B,C,D

AAABBBBCDE
##<3+4+1+1+1>*5*4##... choice A,B

AAABBBBCDE
##<3+2+2+2+1>*5*4##... choice A,B

##7-of-a-kind##
In addition to (*)

AAAAAAABBC
##<7+2+1>*5*4*3## ...choice A,B,C

AAAAAAABCD
##<7+1+1+1>*5*4## ...choice A,E


********************************************
N(11)

##Two\ 4-of-a-kind##

AAAABBBBCCC
##<4+4+3>*5*\ _4C_2 ##... choice C,(AB)

AAAABBBBCCD
##<4+4+2+1>*5*4*3##... choice C,D,E

AAAABBBBCDE
##<4+4+1+1+1>*\ _5C_2##... choice (AB)

##One\ 4-of-a-kind##

AAAABBBBBBB (*)
##<4+7>*5*4## choice A,B

AAAABBBBBBC
##<4+6+1>*5*4*3## choice A,B,C

AAAABBBBBCC
##<4+5+2>*5*4*3## choice A,B,C

AAAABBBBBCD
##<4+5+1+1>*5*4*3## choice A,B,E

AAABBBCCCD
##<4+3+3+1>*5*4*3## choice A,D,E

AAAABBBCCDD
##<4+3+2+2>*5*4*3## choice A,B,E

AAAABBBCCDE
##<4+3+2+1+1>*5*4## choice A,B

##7-of-a-kind##
In addition to (*)

AAAAAAABBBC
##<7+3+1>*5*4*3## choice A,B,C

AAAAAAABBCC
##<7+2+2>*5*\ _4C_2## choice A,(BC)

AAAAAAABBCD
##<7+2+1+1>*5*4*3## choice A,B,E

AAAAAAABCDE
##<7+1+1+1+1>*5## choice A

*****************************************
N(12)

##Two\ 5-of-a-kind##

AAAAABBBBBCC
##<5+5+2>*5*\ _4C_2 ##... choice C,(AB)

AAAAABBBBBCD
##<5+5+1+1>*5*\ _4C_2 ##... choice E,(AB)

##One\ 5-of-a-kind##

AAAAABBBBBBB (*)
##<5+7>*5*4## choice A,B

AAAAABBBBBBC
##<5+6+1>*5*4*3## choice A,B,C

AAAAABBBBCCC
##<5+4+3>*5*4*3## choice A,B,C

AAAAABBBBCCD
##<5+4+2+1>*5*4*3*2## choice A,B,C,D

AAAAABBBCCCD
##<5+3+3+1>*5*4*3## choice A,D,E

AAAAABBBCCDD
##<5+3+2+2>*5*4*3## choice A,B,E

AAAAABBBBCDE
##<5+4+1+1+1>*5*4## choice A,B

AAAAABBBCCDE
##<5+3+2+1+1>*5*4*3## choice A,B,C

AAAAABBCCDDE
##<5+2+2+2+1>*5*4## choice A,E

##7-of-a-kind##
In addition to (*)

AAAAAAABBBBC
##<7+4+1>*5*4*3## choice A,B,C

AAAAAAABBBCC
##<7+3+2>*5*4## choice A,B,C

AAAAAAABBBCD
##<7+3+1+1>*5*4*3## choice A,B,E

AAAAAAABBCCD
##<7+2+2+1>*5*4*3## choice A,D,E

AAAAAAABBCDE
##<7+2+1+1+1>*5*4## choice A,B

*****************************************
N(13)

##Two\ 6-of-a-kind##

AAAAAABBBBBC
##<6+6+1>*5*\ _4C_2 ##... choice C,(AB)

##One\ 6-of-a-kind##

AAAAAABBBBBBB (*)
##<6+7>*5*4## choice A,B

AAAAAABBBBBCC
##<6+5+2>*5*4*3## choice A,B,C

AAAAAABBBBCCC
##<6+4+3>*5*4*3## choice A,B,C

AAAAAABBBBBCD
##<6+5+1+1>*5*4*3## choice A,B,E

AAAAAABBBBCCD
##<6+4+2+1>*5*4*3*2## choice A,B,C,D

AAAAAABBBCCCD
##<6+3+3+1>*5*4*3## choice A,D,E

AAAAAABBBCCDD
##<6+3+2+2>*5*4*3## choice A,B,E

##7-of-a-kind##
In addition to (*)

AAAAAAABBBBBC
##<7+5+1>*5*4*3## choice A,B,C

AAAAAAABBBBCC
##<7+4+2>*5*4*3## choice A,B,C

AAAAAAABBBCCC
##<7+3+3>*5*\ _4C_2## choice A,(BC)

AAAAAAABBBBCC
##<7+4+1+1>*5*4*3## choice A,(BC)

AAAAAAABBBCCD
##<7+3+2+1>*5*4*3*2## choice A,B,C,D

AAAAAAABBCCDD
##<7+2+2+2>*5*4## choice A,E

AAAAAAABBBCDE
##<7+3+1+1+1>*5*4## choice A,B

AAAAAAABBCCDE
##<7+2+2+1+1>*5*\ _4C_2## choice A,(BC)

****************************
N(14)

##Two\ 7-of-a-kind##

AAAAAAABBBBBBB
##<7+7>*5*4##... choice A,B

##One\ 7-of-a-kind##

AAAAAAABBBBBBC
##<7+6+1>*5*4*3## choice A,B,C

AAAAAAABBBBBCC
##<7+5+2>*5*4*3## choice A,B,C

AAAAAAABBBBCCC
##<7+4+3>*5*4*3## choice A,B,C

AAAAAAABBBBBCD
##<7+5+1+1>*5*4*3## choice A,B,E

AAAAAAABBBBCCD
##<7+4+2+1>*5*4*3*2## choice A,B,C,D

AAAAAAABBBCCCD
##<7+3+3+1>*5*4*3## choice A,D,E

AAAAAAABBBCCDD
##<7+3+2+2>*5*4*3## choice A,B,E

AAAAAAABBBBCDE
##<7+4+1+1+1>*5*4*3## choice A,B,E

AAAAAAABBBCCDE
##<7+3+2+1+1>*5*4*3## choice A,B,C

AAAAAAABBCCDDE
##<7+2+2+2+1>*5*4## choice A,E

**********************************
 
Last edited:
  • #37
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
2022 Award
23,995
15,676
I spotted a short cut of sorts. We can simply convert the successful patterns from one value of ##n## to the next. Every pattern for seven dice with at least one 0 can be changed to a pattern for eight dice with at least one 1 and vice versa. There are eleven successful patterns for every ##n## from ##0## to ##7##. E.g., from above, the successful patterns for ##n = 0## (must have a ##7##):

7, 7, 0, 0, 0
7, 6, 1, 0, 0
7, 5, 2, 0, 0
7, 5, 1, 1, 0
7, 4, 3, 0, 0
7, 4, 2, 1, 0
7, 4, 1, 1, 1
7, 3, 3, 1, 0
7, 3, 2, 2, 0
7, 3, 2, 1, 1
7, 2, 2, 2, 1

These can immediately be converted to the successful patterns for ##n = 1## (must have a ##6##), which are:

7, 6, 0, 0, 0 [20]
6, 6, 1, 0, 0 [30]
6, 5, 2, 0, 0 [60]
6, 5, 1, 1, 0 [60]
6, 4, 3, 0, 0 [60]
6, 4, 2, 1, 0 [120]
6, 4, 1, 1, 1 [20]
6, 3, 3, 1, 0 [60]
6, 3, 2, 2, 0 [60]
6, 3, 2, 1, 1 [60]
6, 2, 2, 2, 1 [20]

And, to get the patterns for ##n = 2## just take these and replace a ##6## with a ##5## etc.

The only tedious bit is to check each of these patterns for the first calculation. If the pattern is of the form ##xyyyy##, then we have ##5## sub-patterns; ##xyzzz## has ##20## etc. I've put these in square brackets above.

The second calculation can be done by setting up a rule, where ##k = 14 - n## and the five numbers in each row are ##r_1## to ##r_5##. This is the number of ways to get each sub-pattern:
$$\binom k {r_1} \binom {k - r_1}{r_2} \binom{k - r_1 - r_2}{r_3} \binom {k-r_1 -r_2 - r_3}{r_4} \binom{k - r_1 -r_2 - r_3 - r_4}{r_5}$$
We just multiply this by the number from the first calculation (in square brackets).

This can all just be put in a spreadsheet and cut and pasted. E.g. for ##n = 1## we have:

7​
6​
0​
0​
0​
20​
1716​
1​
1​
1​
1​
34320​
6​
6​
0​
0​
0​
30​
1716​
7​
1​
1​
1​
360360​
6​
5​
2​
0​
0​
60​
1716​
21​
1​
1​
1​
2162160​
6​
5​
1​
1​
0​
60​
1716​
21​
2​
1​
1​
4324320​
6​
4​
3​
0​
0​
60​
1716​
35​
1​
1​
1​
3603600​
6​
4​
2​
1​
0​
120​
1716​
35​
3​
1​
1​
21621600​
6​
4​
1​
1​
1​
20​
1716​
35​
3​
2​
1​
7207200​
6​
3​
3​
1​
0​
60​
1716​
35​
4​
1​
1​
14414400​
6​
3​
2​
2​
0​
60​
1716​
35​
6​
1​
1​
21621600​
6​
3​
2​
1​
1​
60​
1716​
35​
6​
2​
1​
43243200​
6​
2​
2​
2​
1​
20​
1716​
21​
10​
3​
1​
21621600​
140214360​
0.114864​

The probability of success, given one ##1## is ##0.114864##. Then, we just put all this together and we get:


np(n)q(n)p(n)q(n)
0
0.077887​
0.046058​
0.003587​
1
0.218082​
0.114864​
0.02505​
2
0.283507​
0.25962​
0.073604​
3
0.226806​
0.489781​
0.111085​
4
0.124743​
0.692675​
0.086406​
5
0.049897​
0.820961​
0.040964​
6
0.014969​
0.886374​
0.013268​
7
0.003422​
0.78496​
0.002686​
0.999313​
0.35665​

That's a final answer of ##p = 0.35665##.
 
Last edited:
  • Like
Likes FactChecker, sysprog and anuttarasammyak
  • #38
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,410
That's a final answer of ##p = 0.35665##.
That looks a bit high compared with @FactChecker's Monte Carlo simulation in #6. I wonder why?
 
  • #39
FactChecker
Science Advisor
Homework Helper
Gold Member
7,720
3,389
That looks a bit high compared with @FactChecker's Monte Carlo simulation in #6. I wonder why?
0.35665 is close to what I ended up with when the rules were all decided on and I fixed a bug in my code. I made 20 runs just now of 1 million tests each (1 test=14 dice tossed). The 20 results ranged from 0.3561 to 0.3574 and averaged 0.35660.
 
  • #40
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,410
0.35665 is close to what I ended up with when the rules were all decided on and I fixed a bug in my code. I made 20 runs just now of 1 million tests each (1 test=14 dice tossed). The 20 results ranged from 0.3561 to 0.3574 and averaged 0.35660.
I translated your code in post #6 into JavaScript almost exactly (I used zero based arrays) and got similar results to those you posted in #6 so I guess this must be before you fixed the bug. My code runs in the browser on jsfiddle.
 
  • #41
FactChecker
Science Advisor
Homework Helper
Gold Member
7,720
3,389
I translated your code in post #6 into JavaScript almost exactly (I used zero based arrays) and got similar results to those you posted in #6 so I guess this must be before you fixed the bug. My code runs in the browser on jsfiddle.
I don't remember posting code in a post #6. Do you mean post #26? I posted a couple of versions. That first version was in post #19. It had an early bug in the random number generation call which I fixed as mentioned in post #21. The second version was in post #26. The problem in that was that it did not count a success if there were 7 1's and other numbers with 0. It was decided that those should count as a success and that the results of #26 were too low. After fixing that my results agreed closely to the 0.35665.
 
  • #42
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,410
I don't remember posting code in a post #6. Do you mean post #26?
Yes I linked to post #26 but labelled it as #6 by mistake.

The second version was in post #26. The problem in that was that it did not count a success if there were 7 1's and other numbers with 0. It was decided that those should count as a success and that the results of #26 were too low. After fixing that my results agreed closely to the 0.35665.
Ah OK, I made the same change and agree with this result.
 
  • Like
Likes FactChecker

Suggested for: Probability in a dice game

  • Last Post
Replies
6
Views
680
  • Last Post
Replies
1
Views
499
  • Last Post
Replies
15
Views
704
  • Last Post
Replies
16
Views
876
Replies
7
Views
339
Replies
9
Views
655
  • Last Post
Replies
3
Views
504
Replies
3
Views
229
Replies
2
Views
459
  • Last Post
2
Replies
42
Views
3K
Top