Probability in a dice game

In summary, we are playing a game with regular, fair, six-sided dice and we are throwing 14 of them. The "1" is a "joker", meaning it can count as any other number. We want to know the probability of getting exactly seven of any face value. After attempting various calculations, it seems that the probability is around 35.7%. However, it is not a simple calculation as we must consider the possibility of getting seven of more than one face value simultaneously. A Monte Carlo simulation may be a more practical approach to finding an approximate solution.
  • #1
Norway
50
3
TL;DR Summary
You throw 14 (fair, six-sided) dice. What is the probability of getting exactly 7 of a kind, when the number 1 is a "joker"?
We're playing a game with regular, fair, six-sided dice, and we're throwing 14 of them.

The "1" is a "joker", which means it can count as any other number. So, for example, if we roll three "1"s and four "2"s, we have seven "2"s.

What is that probability that we get exactly seven of any face value?At first glance, this seemed like simple, high school probability stuff, but I kept crashing into more and more walls trying to calculate it, so now I'm not so sure. There was always something I missed, which made the calculation much, much harder once I corrected my mistake. It might still be easy, though, I don't know. I've been banging my head to the point I've become blind.After a few tries with horrible logical flaws, I eventually started thinking about probability trees. For example, for the first dice, there is a 5/6 probability that it comes out {2,3,4,5,6}, in which case I can do a binomial distribution for the 13 remaining dice, where I have 13C6, and p=1/3. However, there is a 1/6 chance that the first dice is a "1", in which case the problem is just transposed by one notch, giving a 5/6 probability for {2,3,4,5,6} on the second dice and binomial 12C5 for the rest, and then 1/6 for getting a "1" on the third aswell, and ... ... ... ... This is getting deep. I had to rethink.

My latest attempt was simply considering the probability of success with a specific number, for example "2".
For each dice, the probability of getting a "2" is 1/3 (both "1" and "2" is a success). Therefore, the probability of getting seven "2"s out of 14 is: 14C7*(1/3)7*(2/3)7 = 0,0918...
Then I thought I could just multiply this by 5, because what goes for "2" obviously goes for "3", "4", "5" and "6" as well. ...Right?

Alas, no.
I completely forgot that we can get seven of more than just one value. In fact we can get seven of four values simultaneously. Consider, for example, the following roll: {1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6}. Here we have seven of both "2"s, "3"s, "4"s and "5"s.

At this point I actually gave up on all calculations, and just wrote a Python script to simulate it. It seems to converge around 35.7%, so assuming I coded correctly, I guess that is the answer.

But why is it 35.7%? How would you calculate this in a clean and simple manner by hand?

If you read through all this, and want to have a go – thank you so much!
 
Last edited:
  • Like
Likes etotheipi
Physics news on Phys.org
  • #2
In simpler case of forgetting about Joker, I calculate it be
[tex]\frac{6*_{14}C_7*5^7}{6^{14}}=0.0205...[/tex]
So if both you and I are correct, Joker increases the probability about 18 times.

I am not sure how to count joker. Say we have six same reads and two joker, total eight same reads are not our case or we can take only one of the two to meet the case of seven same reads ?
 
Last edited:
  • #3
Norway said:
Summary:: You throw 14 (fair, six-sided) dice. What is the probability of getting exactly 7 of a kind, when the number 1 is a "joker"?

We're playing a game with regular, fair, six-sided dice, and we're throwing 14 of them.

The "1" is a "joker", which means it can count as any other number. So, for example, if we roll three "1"s and four "2"s, we have seven "2"s.

What is that probability that we get exactly seven of any face value?

One approach is to consider the number of 1's. If you have five or more 1's then you are bound to be able to get at least one seven of a kind.

With four 1's you need three to seven of any other number.

Then, with three 1's you need four to seven of any other number (*).

And similarly with two, one and zero 1's.

It's quite a lot of calculation, but relatively straightforward. If we take the case (*), for example. You could look next at the number of 2's:

In each case of zero to three 2's you then move on to the possibilities for 3's.
In each case of four to seven 2's you have success.
In the case of more than seven 2's it's a fail.

Etc.

A lot of calculation!
 
  • Like
Likes FactChecker
  • #4
I do not see an analytical solution that would not be very complicated. If it is something where an approximation is adequate, then a Monte Carlo simulation may be more practical.
 
  • #5
By the strategy of PeroK, the number of the case is
[tex]\sum_{n=5}^{14}\ _{14}C_n *5^{14-n}+\sum_{n=0}^4\ _{14} C_n *F(14-n,7-n) [/tex]
where F(a,b) is number of the case that ##a## dices have equal or more than ##b## and equal or less than seven same numbers out of 5 possible numbers,i.e. 6 - joker card,
[tex]F(a,b)=5\sum_{n=b}^7\ _aC_n *4^{a-n}[/tex]
 
  • #6
EDIT to post #5

F(a,b) was overestimate.
For n=4 we can have maximum three seven-sets.
For n=0,1,2,3 we can have two seven- sets
we have to reduce these cases.
 
  • #7
Norway said:
Alas, no.
I completely forgot that we can get seven of more than just one value. In fact we can get seven of four values simultaneously. Consider, for example, the following roll: {1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6}. Here we have seven of both "2"s, "3"s, "4"s and "5"s.
So what fraction is this. Is this one "success" in one trial or is it 4 "successes" in ?how many trials? In the 4 success case, it can not be one trial because that could give more successes than trials.
 
  • #8
FactChecker said:
So what fraction is this. Is this one "success" in one trial or is it 4 "successes" in ?how many trials? In the 4 success case, it can not be one trial because that could give more successes than trials.
Why not more than 1 success in 1 trial? In 1 of ##6^{14}## cases, we get all 1s.
There are $$\frac{n!} {(n1r)!~*~r!}$$ ways without regard for order to select ##r## objects from a set of ##n## objects. In the case of ##(r=7,~n=14)##, that's 3432 combinations. For each of the 3432 selections, there will be a unique combination of 7 non-selected dice remaining, for a total of 6864 combinations of 7 numbers. Each of those could assigned to be all the same as any of the 6 possible numbers, so there is a maximum of 41,184 different successes possible on 1 trial. any 2 of which can occur simultaneously, for a total of 20,592 possible pairs of successes on a single trial.
 
  • #9
sysprog said:
Why not more than 1 success in 1 trial? In 1 of ##6^14## cases, we get all 1s.
There are $$\frac{n!} {(n1r)!~*~r!}$$ ways without regard for order to select ##r## objects from a set of ##n## objects. In the case of ##(n=7,~r=14)##, that's 3432 combinations. For each of the 3432 selections, there will be a unique combination of 7 non-selected dice remaining, for a total of 6864 combinations. Each of those could assigned to be all the same as any of the 6 numbers, so there is a maximum of 41,184 different successes possible on 1 trial. any 2 of which can occur simultaneously, for a total of 20,592 possible pairs of successes on a single trial.
Yes, I agree with all of that. I should have been more clear. In defining the fraction of the entire population that has exactly 7 of the same number, I don't know what the population is. Does one roll of the 14 dice represent one sample or multiple samples? It's not clear to me how the sample set for one roll of 14 dice is defined. There must be a larger population of samples than the possible number of "successful" 7's.
(I am still not sure it I am stating this clearly.)
 
  • #10
It seems to me that you have to sum the sums of the numbers of possible 7-matchings for each number of 1s from 0 to 14, and that total divided by ##6^{14}## is the probability of at least one 7-matching.
 
  • Like
Likes FactChecker
  • #11
sysprog said:
It seems to me that you have to sum the sums of the numbers of possible 7-matchings for each number of 1s from 0 to 14, and that total divided by ##6^{14}## is the probability of at least one 7-matching.
Of course. I don't know why that wasn't obvious to me. Sorry.
 
  • Like
Likes sysprog
  • #12
FactChecker said:
Of course. I don't know why that wasn't obvious to me. Sorry.
Well, I only explained the all 1s case --

With 1s not treated as being 'jokers' or 'wild':

For ##n## dice, the probability ##P## that exactly ##r## dice are showing the same-number face is $$P(r) = C(n,r)~*~(1/6)^r~*~(5/6)^{n-r}$$ where ##C(n,r)## is the number of unique subsets consisting of ##r## dice out of the set of ##n## dice (binomial distribution ##B(n,\frac 1 6)##)

For ##n## dice, the probability ##P'## that at least ##r## dice are showing the same-number face is the sum of ##P(x)## for all ##x## such that ##r \le x \le n##, i.e., $$P'(r)= \sum_{x=r}^nC(n,x)~*~(1/6)^x~*~(5/6)^{n-x}$$
The problem calls for exactly 7 matching numbers, so the 1st equation should be used.

Re-introduction of the impact of the condition that 1s are wild is left for another post.
 
Last edited:
  • #13
Some glitch (probably a MathJax error) messed up my ##\LaTeX## in this post, so I've cut the content and pasted it to a local file for repairs and will try again later.
 
Last edited:
  • #14
Edit to posts #5 and #6
For number of joker n=0,1,2,3,4 maximum two seven-sets are possible. Number of redundant count in post #5 is
[tex] \ _5C_2 \sum_{n=0}^4 \sum_{k=7-n}^7\ _{14}C_n \ _{14-n}C_k[/tex]
This should be subtracted from the formula of post #5.

As s result the number of cases of seven-sets done is
[tex]\sum_{n=5}^{14}\ _{14}C_n*5^{14-n}+\sum_{n=0}^4\ _{14}C_n\ _5C_1 \sum_{k=7-n}^7\ _{14-n}C_k*4^{14-n-k} -\sum_{n=0}^4\ _5C_2 \sum_{k=7-n}^7\ _{14}C_n \ _{14-n}C_k[/tex]
[tex]=\sum_{n=5}^{14}\ _{14}C_n*5^{14-n}+\sum_{n=0}^4\sum_{k=7-n}^7 \ _{14}C_n \ _{14-n}C_k [\ _5C_1*4^{14-n-k}-\ _5C_2][/tex][tex]=5,405,179,721+40,762,155,720=46,167,335,441[/tex]
46,767,335,441 / 6^14 = 0.589... Too much ?
 
Last edited:
  • #15
I apologize for any ambiguity and/or confusion I caused.
The throw is considered successful if there is exactly seven of any value.
This means that 8-of-a-kind is NOT successful (unless it coincidentally happens to have another 7-of-a-kind in the same throw).
It doesn't matter if the throw includes one, two, three or four 7-of-a-kinds.

If the throw has at least one 7-of-a-kind, it is a success.
If it does not, then it is not a success.

The question is: if I throw once, what is the probability that the throw is successful?

I hope this makes the problem clearer.

And thank you so much for all your replies! I'm very grateful for all your responses and engagement!PS:
As I mentioned in my OP, I made a script to simulate this, which converges around 0.357 probability. Has anyone else calculated it through, or simulated it themselves, and can confirm or confute this?
 
  • #16
As I asked in post #2, please confirm that Joker is interpreted as we wish to make 7-of-a-kind.
For example all 14 joker(=1) is 7-of-a-kind because we can interpret it e.g. as 7 of number 2 and 7 of other numbers. Is it right?
 
  • #17
anuttarasammyak said:
As I asked in post #2, please confirm that Joker is interpreted as we wish to make 7-of-a-kind.
For example all 14 joker(=1) is 7-of-a-kind because we can interpret it e.g. as 7 of number 2 and 7 of other numbers. Is it right?
All "1"s are restricted to the same value. That is, either all "1"s count as "2"s, or "3"s, or "4"s, or "5"s, or "6"s. You can not split the "1"s on different values.
So:
✅ {1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5} (seven "2"s)
❌ {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5} (many 8-of-a-kinds, but no 7-of-a-kinds)

Thank you for your question! Very useful clarification.

PS:
If I'm not mistaken, if we were to allow splitting of the "1"s—this would be the same as counting all 7-of-a-kinds, 8-of-a-kinds, ...and up... as successes. ...Right?
Edit 2:
No, it's not. Never mind.
 
  • #18
Thanks for clarification. Now I know my result post #14 which allows splitting Jokers as we wish to make 7-of-a-kind is not right one in your rule.
 
  • #19
Norway said:
As I mentioned in my OP, I made a script to simulate this, which converges around 0.357 probability. Has anyone else calculated it through, or simulated it themselves, and can confirm or confute this?
I made a simulation based on what I understood the problem to be and got similar results
The results of 20 runs with 1 million tests/run (1 test = roll 14 dice):
run     prob
1       0.356791
2       0.355876
3       0.357321
4       0.356964
5       0.355656
6       0.357053
7       0.356231
8       0.356391
9       0.356573
10      0.356955
11      0.356979
12      0.35705
13      0.356346
14      0.35644
15      0.355669
16      0.357163
17      0.357378
18      0.356632
19      0.35673
20      0.356985
Here is the Perl program that I used::
$numRuns = 20; # do 20 runs
$numTests = 1000000; # 1 million tests for each run
print "run    prob\n";
foreach $run (1..$numRuns){ # loop through the runs
    $total7=0; # variable for the number of tests in this run that totaled 7
    foreach $test (1..$numTests){ # loop through the tests for this run
        $test++;
        &sample;
    }
           # calc fraction of 7's in this run and print
    $prob = $total7/$numTests;
    print "$run \t$prob\n";
}

# 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]++;
    }
    # determine if the number of 1s plus any other adds to 7
    foreach $j (2..6){
        if( ($results[1] + $results[$j]) == 7 ){$total7++; return}
    }
}
 
  • #20
FactChecker said:
Perl:
foreach $j (2..6){
    if( ($results[1] + $results[$j]) == 7 ){$total7++; return}
}
I've never coded in Perl, but... Does this mean that one throw can generate multiple successes? One throw is either a (one) success, or not.

Also, I might have made coding errors. I'm not entirely confident in my own coding abilities. :oldtongue:
Here's my Python script:
Python:
import randomN = 1_000_000

def is_win(dice):
    for d in dice[1:]:
        if dice[0]+d == 7:
            return True
    return False

def generate_dice():
    roll = [random.randint(1,6) for _ in range(14)]
    dice = [roll.count(i) for i in range(1, 7)]
    return dice

if __name__ == "__main__":
    wins = 0
    for _ in range(N):
        dice = generate_dice()
        if is_win(dice):
            wins += 1

    print(f"Threw {N} times")
    print(f"Won {wins} times")
    print(f"Probability: {100*wins/N}%")
Code:
$ python3 diceroll.py
Threw 1000000 times
Won 357187 times
Probability: 35.7187%

Curiously, if I change my == 7 to >= 7 (allowing 8,9,10,...-of-a-kind), then I too get 0.492. If counting multiple successes per throw (for exactly seven) gives the same number of successes as any >=7-of-a-kind with only one success per throw, then I'd like an explanation for that as well, because that is interesting in its own right. :oops::oldbiggrin:
 
  • #21
@Norway , My apologies. My code had an error that I saw right after I posted and I tried to correct it before it was read. Apparently I was too slow. Sorry.
I had to change $die = int(rand(5)+1); to $die = int(rand(6)+1);
With that, I get essentially the same answers that you got. I consider this a good check of both our code versions and that we agree on the statement of the problem.
 
  • Like
Likes Norway
  • #22
I think this is a good example of how quickly an apparently simple problem becomes hard to solve analytically. The simplicity of a Monte Carlo simulation can be a real advantage. Even if an analytical solution can be found, a simulation may be necessary to be confident of the analysis.
 
  • Like
Likes PeroK
  • #23
One question: does having exactly seven 1's count? For example, if we have seven 1's and at least one of each of the other numbers 2-6, does that count as a success? Where we have exactly seven 1's, but we can't make exactly seven of anything else.

I might have had an idea on how to count these. It's still not easy. I'll post the idea when I've had time to think about it!
 
  • Like
Likes FactChecker
  • #24
PeroK said:
One question: does having exactly seven 1's count? For example, if we have seven 1's and at least one of each of the other numbers 2-6, does that count as a success? Where we have exactly seven 1's, but we can't make exactly seven of anything else.
No, the "1"s are only jokers, so in this case, every legit value will have eight or more of a kind. Good question!

If there were zero of any value, for example no "4"s, then it would be a success, though, as the seven "1"s would make seven "4"s!
PeroK said:
I might have had an idea on how to count these. It's still not easy. I'll post the idea when I've had time to think about it!
Great! Looking forward to it :biggrin:
 
  • #25
Norway said:
No, the "1"s are only jokers, so in this case, every legit value will have eight or more of a kind. Good question!

If there were zero of any value, for example no "4"s, then it would be a success, though, as the seven "1"s would make seven "4"s!
Great! Looking forward to it :biggrin:
I think this would work. It's still not that simple.

The problem is that there are too many ways to create one or more sets of seven. But, there are fewer ways to get more than one seven and these are easier to count. Again, we look at each case for the number of 1's separately. We calculate:

##p(n, m)## the probability of getting exactly ##m## sets of seven, with ##m > 1##, given there are ##n## 1's. For example:

If we have zero 1's then we must calculate only ##p(0, 2)##.: the probability of getting exactly two sets of seven.

Altogether we must calculate:

##p(0,2), p(1, 2), p(2,2), p(3, 2), p(4,2), p(4, 3), p(5, 2), p(5, 3), p(5,4), p(6, 2), p(6, 3), p(6,4), p(7,2), p(7,3), p(7,5)##

The rest are all zero. For example, if we have four 1's, then we have ten remaining dice and to calculate ##p(4, 2)## we need a pattern of the form:

##7, 3, 0, 0, 0##
##4, 3, 3, 0, 0##
##3, 3, 2, 2, 0##
##3, 3, 2, 1, 1##

And for ##p(4,3)## we need a pattern of the form:

##3, 3, 3, 1, 0##

In any case, these probabilities are not too hard to calculate.

The trick is to avoid having to calculate ##p(n, 1)##, as there are a lot of cases/patterns.

We can also calculate, for each value of ##n##, the probability of being able to get seven 2's. And from this, we get the expected value of getting seven twos. And, multiplying by 5, the expected value of sevens: ##E(n)##. This is the expected number of sevens given ##n## ones.

This allows us to calculate the probabilities ##p(n, 1)##, which were the complicated ones. And, hence the probability of getting at least one seven (given there are ##n## ones):
$$P(n) = \sum_{m=1}^5 p(n, m)$$
And, then to overall probability is:
$$P = \sum_{m=0}^7 P(n)$$

It's a bit complicated to write down, and there are still about 50 calculations.
 
  • Informative
Likes etotheipi
  • #26
Norway said:
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
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 successful (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
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.

FactChecker said:
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 anyone 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
@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
@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
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
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
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 ETHREE 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,ETWO 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.ESum 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
sysprog said:
@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.
sysprog said:
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:

anuttarasammyak said:
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
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:

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
15
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
42
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
10
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
2K
Back
Top