Probability in a dice game

  • Context: High School 
  • Thread starter Thread starter Norway
  • Start date Start date
  • Tags Tags
    Dice Game Probability
Click For Summary
SUMMARY

The discussion focuses on calculating the probability of rolling exactly seven of a kind using 14 fair six-sided dice, where the "1" acts as a joker that can represent any other number. The probability was initially estimated using binomial distribution methods, leading to a conclusion that the probability converges around 35.7% based on a Python simulation. The complexity arises from the possibility of achieving multiple seven-of-a-kinds simultaneously, which complicates the calculations significantly. The final consensus is that the joker increases the probability of achieving seven of a kind significantly compared to a scenario without jokers.

PREREQUISITES
  • Understanding of basic probability theory
  • Familiarity with binomial distribution and combinations
  • Knowledge of Monte Carlo simulation techniques
  • Experience with Python programming for statistical simulations
NEXT STEPS
  • Study the binomial distribution in depth, particularly in the context of dice games
  • Learn how to implement Monte Carlo simulations in Python for probability estimation
  • Explore advanced probability concepts such as conditional probability and combinatorial analysis
  • Investigate the impact of "wild" or joker elements in probability calculations across different games
USEFUL FOR

Mathematicians, game developers, statisticians, and anyone interested in probability theory and its applications in gaming scenarios.

  • #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   Reactions: sysprog
Physics news on Phys.org
  • #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
\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 ?
*********************************************************

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,
N(7)=5
N(8)=5*\ _8C_1 * 4^7
N(14)=\ _{14}C_7(5*(4^7 - 4)+\ _5C_2) 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 occurrence is expressed as
ABCDEEEE or 1+1+1+1+4
\frac{8!}{1!1!1!1!4!}*5
coefficient 5 : choice of ETHREE 1-of-a-kind

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

ABCDDEEE or 1+1+1+2+3
\frac{8!}{1!1!1!2!3!}*5*4
coefficient 5*4 : choice of D,ETWO 1-of-a-kind

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

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

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

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

ONE 1-of-a-kind

ABBBBBBB or 1+7
\frac{8!}{1!7!}*5*4
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
\frac{8!}{1!5!2!}*5*4*3
coefficient 5*4*3 : choice of A,B,C

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

ABBBCCDD or 1+3+2+2
\frac{8!}{1!3!2!}*5*4*3
coefficient 5*4*3 : choice of A,B.ESum of these cases gives N(8)=3,118,240

Similarly for N(9)

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

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

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

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

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

ONE 2-of-a-kind

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

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

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

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

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

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

7-of-a-kind
In addition to above (*)
AAAAAAABC 7+1+1
\frac{9!}{7!1!1!}*5*\ _4C_2
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   Reactions: 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:
  • #36
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.

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 ?
*********************************************************
*************************************
N(10)

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

For brevity I introduce < > notation for number of multiset multiset permutation of the case AAABBBCCCD
&lt;3+3+3+1&gt; = \frac{10!}{3!3!1!}
##<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
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   Reactions: FactChecker, sysprog and anuttarasammyak
  • #38
PeroK said:
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
pbuk said:
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
FactChecker said:
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
pbuk said:
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   Reactions: pbuk
  • #42
FactChecker said:
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.

FactChecker said:
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   Reactions: FactChecker

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 42 ·
2
Replies
42
Views
5K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
5
Views
1K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K