Probability in a dice game

  • B
  • Thread starter Norway
  • Start date
  • #26
FactChecker
Science Advisor
Gold Member
5,741
2,128
No, the "1"s are only jokers, so in this case, every legit value will have eight or more of a kind. Good question!
What do you mean by "legit value". Those cases do not count, right?
In that case, I added line 9 below to my simulation code before the test is checked: if( $results[1] == 7 ){return} # this does not count
Perl:
# Define subroutine to do one sample test
# and accumulate the number of tests that had a total of 7 in $total7
sub sample {
    undef @results;
    foreach $i (1..14){ # roll 14 die
        $die = int(rand(6)+1);
        $results[$die]++;
    }
    if( $results[1] == 7 ){return} # this does not count
    # determine if the number of 1s plus any other adds to 7
    foreach $j (2..6){
        if( ($results[1] + $results[$j]) == 7 ){$total7++; return}
    }
}
It gave these results (again each run is 1 million tests of 14 dice):
Code:
run     prob
1       0.354199
2       0.354228
3       0.353572
4       0.353242
5       0.353368
6       0.353467
7       0.354585
8       0.354318
9       0.354693
10      0.354341
11      0.353572
12      0.354714
13      0.353547
14      0.354002
15      0.354057
16      0.353567
17      0.353986
18      0.353638
19      0.353596
20      0.355257
 
  • #27
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
14,309
6,684
Let's at least try to establish the rules unambiguously. Let ##n## be the number of 1's:

##n = 0## (no 1's): to be successful we must have exactly seven of at least one number. E.g. 22222223333333 is succesful (seven of both 2 and 3); but 22222222333333 is a fail (eight 2's and six 3's).

##n = 1##: to be successful we must have either or both: exactly seven of at least one number; or, exactly six of at least one number. In the latter case, we use the 1 as a joker:

12222222345634 is a success (seven 2's)

12222223333334 is a success (six 2's and six 3's)

##n = 2##: to be successful we must have either or both: exactly seven of at least one number; or, exactly five of at least one number. In the latter case, we use both 1's as jokers. Note that having exactly six of one number is a failure, as we must use all or none of the 1's:

11222223456345 is a success (five 2's plus the two ones)

11222222345345 is a fail (six 2's: cannot use only one 1)

11222222234534 is a success (seven 2's: don't need the ones).

Etc.
 
  • Like
Likes FactChecker
  • #28
50
3
Thank you for all your questions! There are a lot of very good questions, most of which I hadn't even considered. I double-checked with the game master now, to clarify the rules once and for all.

The "1"s are mandatory, which means you must use them all, whenever you're counting a value.

What do you mean by "legit value". Those cases do not count, right?
Sorry, by "legit values", I just meant the values {2, 3, 4, 5, 6}. All throws count—either the throw is a success, or it is a fail.

Note: New notation. Instead of writing every single die, we now collect same values in one list element. Sorry for the poor explanation, but hopefully this example illustrates it:
The throw {1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 5, 5, 6} is now given as [7, 3, 1, 0, 2, 1], as there are seven "1"s, three "2"s, one "3", zero "4"s, etc.


So if the value distribution of the roll is: [6, 2, 2, 2, 2, 0], then the throw is unsuccessful, as there are eight "2"s, "3"s, "4"s and "5"s, and only six "6"s. Of course, the "1"s can't be all values simultaneously, but if we check one value at a time, then the "1"s can be any one of them. So:
"How many "2"s do we have? Two, plus the six "1"s = eight.
How many "3"s do we have? Two, plus the six "1"s = eight."
...
How many "6"s do we have? Zero, plus the six "1"s = six."


Now, if there are seven "1"s, then the only ways we can have 7-of-a-kind, is if there is zero of another value. For example:
❌ [7, 2, 1, 2, 1, 1] (Too many of all values)
✅ [7, 2, 1, 0, 1, 3] (Seven "4"s)
✅ [7, 7, 0, 0, 0, 0] (Too many "2"s, but seven "3"s, "4"s, "5"s and "6"s.)
Actually, the last one has seven of all values except "2"s. The "1"s make up a 7-of-a-kind of both "3", "4", "5" and "6".
So, I guess a simple rule would be:
If there are exactly seven "1"s, then the throw is successful if, and only if, any other value is not represented in the throw.

So, to (try to) make it perfectly clear:
For each of the values 2, 3, 4, 5 and 6 — if the amount of any of them, plus the amount of "1"s, equal 7, then the throw is successful. Otherwise, it is not.


Edit:
@PeroK, I interpreted the rules exactly the same way you did. Which also means I had an error in my coding, as I included the amount of "1"s every time I counted values. By "fixing" this, the probability seems to converge around 0.370.
However, after the clarification from the game master, where the "1"s are mandatory and MUST be taken into account, it seems that my code happened to be correct, despite my understanding of the rules being wrong, so I guess the answer is about 0.357 after all. :oops:

So, unambiguously:
If n is the amount of "1"s in the throw, then:
n = 0: Need exactly seven of any other number
n = 1: Need exactly six of any other number
...
n = 6: Need exactly one of any other number
n = 7: Need exactly zero of any other number

This also means that:
❌ [2, 7, 1, 2, 1, 1] is unsuccessful, because there are nine "2"s, and too few of all other values. Despite having exactly seven "2"s. Which is kind of a bummer when playing the game, I guess, but the GM is the boss.
🤷‍♂️ We can invent our own game, though!
 
  • Like
Likes FactChecker
  • #29
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
14,309
6,684
@Norway Okay, thanks. That is different from what I was expecting. It should simplify the calculations somewhat since we're typically looking for one value in each case.
 
  • #30
1,624
881
@Norway: In my opinion, you exhibit a (not especially unusual) propensity for adding new conditions subsequently to the statement of the problem. Some of my consulting clients are apt to do that. Not unlike most of them, you seem to me to be a pleasant person who is genuinely interested in getting things right.

It doesn't really bother me if I'm working on the basis of time and expenses rather than on fixed deliverables, but either way the client wants a specific set of functionalities, and sometimes doesn't articulate all of them sufficiently at the 'specify requirements' stage, even in response to precise probing questions.

I do tend to balk when a client asks me to sign off on a program change as a programming error correction when it is in fact an accommodation of a new requirement. I've successfully negotiated such things as fulfillments of 'enhancement requests', so that no blame has to be assessed to anyone.

Here I'd like to re-state what I see as your current version of the rules:

14 6-sided fair dice ##-##
exactly 7 dice matching wins [if 8 of the dice match, no win is possible] ##-##
1s:
may be any value other than 1 ##-##​
all must be the same value ##-##​
all must be used in any solution ##\cdots##​
[All 3 of those restrictions are significant departures from standard 'jokers wild' rules.]

Is that in your view an accurate and adequate summary of the rules?
 
  • #31
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
14,309
6,684
Although the idea of using the expected number works, that was only necessary because I thought the rules were more complicated. As it stands, here is a way to do it that could be programmed:

For ##n = 0## to ##7## (##n## is the number of 1's).

Calculate ##p(n)## (it's a binomial distribution - I'll not put too many details in this thread).

The criterion for success is to have at least one number occurring ##7-n## times, from ##14 - n## dice. We need all the patterns that meet this. For example, for ##n = 0##, the successful patterns are:

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

You could write a subroutine that would do this for any number. In this case, input ##14, 7, 5## and it would generate all patterns of ##5## numbers that have at least one ##7## and sum to ##14##.

Or, do a subroutine to do them all and then select any with a ##7##.

That's programming challenge #1!

Next, you need to calculate the probability of each of these patterns. In this case with five random possibilities - as we are assuming we are given the number of 1's. For example, for 7, 6, 1, 0, 0, you need the probability of getting 7 of one number, six of another and 1 of a third number. The way I would calculate this is:

60 sub-patterns (where a sub-pattern would be 7 x 2, 6 x 3, 1 x 4) - i.e. 60 is just 5 x 4 x 3.

For each of these the number of possibilities is ##\binom{14} {7} \binom {7} {6}##.

I.e. there are ##60 \times \binom{14} {7} \binom {7} {6}##. ways of getting the pattern 7, 6, 1, 0, 0.

You can add them all up and divide by ##5^{14}##, which is in general ##5^{14-n}##. We could call this ##q(n)## - the probability of success given ##n## 1's.

That's programming challenge #2!

Once you've done this, the total probability is just the sum of ##p(n)q(n)##.

Obviously an alternative is to do something similar for all 6 dice and work the addition of the 1's into the logic.

I can't see any short-cuts.
 
  • Like
Likes sysprog
  • #32
anuttarasammyak
Gold Member
330
154
I still wonder whether I understand the rule rightly so I rewrite the problem.


*********************************************************
Is the number of cases we want is written as
[tex]\sum_{n=7}^{14} \ _{14}C_n*N(n)[/tex]
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 ?
*********************************************************

Here 14-n is number of Jokers and ##\ _{14}C_{14-n}=\ _{14}C_n## is number of their appearance.
Some N(n) is easy to get,
[tex]N(7)=5[/tex]
[tex]N(8)=5*\ _8C_1 * 4^7[/tex]
[tex]N(14)=\ _{14}C_7(5*(4^7 - 4)+\ _5C_2)[/tex] if not mistaken.

I should appreciate it if you confirm/correct my understanding.
 
Last edited:
  • #33
anuttarasammyak
Gold Member
330
154
EDIT to post #32
Revision of N(8)

I found N(8) in #32 is wrong. The following is the revision.

Say five face of dice is ABCDE. We think 1-of-a-kind cases by its numbers.

FOUR 1-of-a-kind

Type of occurence is expressed as
ABCDEEEE or 1+1+1+1+4
[tex]\frac{8!}{1!1!1!1!4!}*5[/tex]
coefficient 5 : choice of E


THREE 1-of-a-kind

ABCDDDDD or 1+1+1+5
[tex]\frac{8!}{1!1!1!5!}*5*4[/tex]
coefficient 5*4 : choice of D,E

ABCDDEEE or 1+1+1+2+3
[tex]\frac{8!}{1!1!1!2!3!}*5*4[/tex]
coefficient 5*4 : choice of D,E


TWO 1-of-a-kind

ABCCCCCC or 1+1+6
[tex]\frac{8!}{1!1!6!}*5*\ _4C_2[/tex]
coefficient ##5*\ _4C_2## : choice of C,(AB)

ABCCCCDD or 1+1+4+2
[tex]\frac{8!}{1!1!4!2!}*5*4*3[/tex]
coefficient 5*4*3 : choice of C,D,E

ABCCCDDD or 1+1+3+3
[tex]\frac{8!}{1!1!3!3!}*5*\ _4C_2[/tex]
coefficient ##5*\ _4C_2## : choice of E,(AB)

ABCCDDEE or 1+1+2+2+2
[tex]\frac{8!}{1!1!2!2!2!}*_5C_2[/tex]
coefficient ##\ _5C_2## : choice of (AB)

ONE 1-of-a-kind

ABBBBBBB or 1+7
[tex]\frac{8!}{1!7!}*5*4[/tex]
coefficient 5*4 : choice of A,B

7-of-a-kind count is included here. No new counting is necessary.

ABBBBBCC or 1+5+2
[tex]\frac{8!}{1!5!2!}*5*4*3[/tex]
coefficient 5*4*3 : choice of A,B,C

ABBBBCCC or 1+4+3
[tex]\frac{8!}{1!4!3!}*5*4*3[/tex]
coefficient 5*4*3 : choice of A,B,C

ABBBCCDD or 1+3+2+2
[tex]\frac{8!}{1!3!2!}*5*4*3[/tex]
coefficient 5*4*3 : choice of A,B.E


Sum of these cases gives [tex]N(8)=3,118,240[/tex]

Similarly for N(9)

FOUR 2-of-a-kind
AABBCCDDE 2+2+2+2+1
[tex]\frac{9!}{2!2!2!2!1!}*5[/tex]
multiplied by choice of E.

THREE 2-of-a-kind
AABBCCDDD 2+2+2+3
[tex]\frac{9!}{2!2!2!3!}*5*4[/tex]
multiplied by choice of D,E.

TWO 2-of-a-kind
AABBCCCCC 2+2+5
[tex]\frac{9!}{2!2!5!}*5*\ _4C_2[/tex]
multiplied by choice of C,(AB).

AABBCCCCD 2+2+4+1
[tex]\frac{9!}{2!2!4!1!}*5*4[/tex]
multiplied by choice of C,D.

AABBCCCDE 2+2+3+1+1
[tex]\frac{9!}{2!2!3!1!1!}*5*\ _4C_2[/tex]
multiplied by choice of C,(AB).

ONE 2-of-a-kind

AABBBBBBB 2+7 (*)
[tex]\frac{9!}{2!7!}*5*4[/tex]
multiplied by choice of A,B.

AABBBBBBC 2+6+1
[tex]\frac{9!}{2!6!1!}*5*4*3[/tex]
multiplied by choice of A,B,C.

AABBBBCCC 2+4+3
[tex]\frac{9!}{2!4!3!}*5*4*3[/tex]
multiplied by choice of A,B,C.

AABBBBBCD 2+5+1+1
[tex]\frac{9!}{2!5!1!1!}*5*4*3[/tex]
multiplied by choice of A,B,E.

AABBBCCCD 2+3+3+1
[tex]\frac{9!}{2!3!3!1!}*5*4*3[/tex]
multiplied by choice of A,D,E.

AABBBBCDE 2+4+1+1+1
[tex]\frac{9!}{2!4!1!1!1!}*5*4[/tex]
multiplied by choice of A,B

7-of-a-kind
In addition to above (*)
AAAAAAABC 7+1+1
[tex]\frac{9!}{7!1!1!}*5*\ _4C_2[/tex]
multiplied by choice of A,(BC)

N(9) is given by summing up the above.
 
Last edited:
  • #34
50
3
@Norway: In my opinion, you exhibit a (not especially unusual) propensity for adding new conditions subsequently to the statement of the problem.
I agree with your observation. As you suggest, I am indeed interesting in getting things right. English is not my first language, and so I'm struggling to formulate and phrase my thoughts and intentions clearly. If I could, I would want the problem to be clearly and unambiguously stated in the first post. Sadly, as mentioned, many of the great questions asked, I hadn't even considered myself, so some elaboration had to be done subsequently. Hopefully, these "new" conditions did not turn the problem upside-down, but rather clear up some ambiguity. The one notable exception being that the jokers must be counted, which surprised even me. I was almost about to send a long post I had written about how the jokers should be optional, just as the game master called me and told me they are mandatory. I do apologize for all uncertainty, and the extra time and effort it has cost the contributors of this thread. I am very grateful for all participation here.
Here I'd like to re-state what I see as your current version of the rules:

14 6-sided fair dice ##-##
exactly 7 dice matching wins [if 8 of the dice match, no win is possible] ##-##
1s:
may be any value other than 1 ##-##​
all must be the same value ##-##​
all must be used in any solution ##\cdots##​
[All 3 of those restrictions are significant departures from standard 'jokers wild' rules.]

Is that in your view an accurate and adequate summary of the rules?
Eight of the same kind doesn't immediately disqualify the throw, for instance if the throw includes: {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, ...} then we have eight "2"s (which is not a success), but at the same time we have seven "3"s, which makes the throw successful.
Otherwise, yes, I do think that's accurate. Every time you count a value, you must also count all the "1"s as that value. For instance, counting the number of "2"s in a throw, you would have to also add the number of "1"s.


@PeroK: Thank you for laying it out in such a clear and organized fashion! I manage to follow along, and I agree with everything you wrote. And a programming challenge it is indeed! It's a little unsatisfying that there are no easier solution, but at the same time it's nice to know that I wasn't a total buffoon when I was called up in the middle of the night by some friends playing a dice game, querying me for a probability calculation. Usually when they do that, I can answer on the fly, or at the very least within a minute or two, but this time I was completely stumped, and I spent hours and hours on this before I just decided to simulate it. At least I can know that I didn't really "fail" the way it felt like then. :oldtongue:

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 ?
I am sorry, but I'm not completely able to take in this statement. I'm not very good at maths, so I don't completely understand your formula either, but I can't seem to relate that to my problem. As I said, English is not my first language, so I have struggles both formulating myself and understanding others, which may be an explanation to why I still haven't been able to properly formulate the problem to you. It seems that both @FactChecker and @PeroK have understood the problem correctly, and they are way better at presenting than I am, so if you're still interested in calculating this further (I think @PeroK has a spot-on solution, and @FactChecker and myself have already simulated it), then I hope you will consider reading their posts. They explain it better than I could. Thank you so much for your participation and interest in my thread!
 
  • Like
Likes PeroK
  • #35
1,624
881
Norway said:
sysprog said:
exactly 7 dice matching wins [if 8 of the dice match, no win is possible]
Eight of the same kind doesn't immediately disqualify the throw, for instance if the throw includes: {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, ...} then we have eight "2"s (which is not a success), but at the same time we have seven "3"s, which makes the throw successful.
Evidently I didn't elaborate on the bracketed remark sufficiently. By my interpretation, in the case of exactly 4 1s, 3 3s, and 4 2s, 1 4, and 2 others, you have either 7 or 8 matching. If you assign the 1s such that you have 8 2s matching, the 8 don't win, and the remaining 6 can't win either; if you assign the 1s to make exactly 7 matching 3s, then you don't have 8 matching. Without that clarification, my bracketed remark is open to the interpretation that you presented -- my intention in making that remark was to briefly illustrate the 'exactly 7 matching' rule.
 
Last edited:
  • #36
anuttarasammyak
Gold Member
330
154
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
14,309
6,684
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
Gold Member
1,604
514
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
Gold Member
5,741
2,128
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
Gold Member
1,604
514
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
Gold Member
5,741
2,128
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.
 
  • Like
Likes pbuk
  • #42
pbuk
Science Advisor
Gold Member
1,604
514
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

Related Threads on Probability in a dice game

  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
8
Views
2K
  • Last Post
Replies
2
Views
6K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
0
Views
3K
  • Last Post
Replies
2
Views
5K
  • Last Post
Replies
19
Views
10K
  • Last Post
Replies
9
Views
2K
  • Last Post
Replies
5
Views
902
Top