Open Side Menu Go to the Top
Register
Craps Probability Craps Probability

05-18-2014 , 01:07 PM
Quote:
Originally Posted by heehaww
Fyi you can execute R code here without installing R. Just have to change the language in the drop-down menu to R, paste the R code then click Evaluate.
Thanks heehaww. Unfortunately, that's not going to work for me. I author a craps simulator called WinCraps which has a feature that allows users to change the probability of the dice (for experimentation, etc.). Whenever a user changes the probability, the program recalculates the expected values and rolls per decision of all the bets and displays them in a reference table. Hence, I need to be able to enter the rolls/dec calculation in my code which is written in visual basic.

Steen
Craps Probability Quote
05-18-2014 , 02:26 PM
Quote:
Originally Posted by Steen
But now the question I've been struggling with: how do I compute the average number of rolls per decision (which includes both winning and losing decisions)?
6 - 6*p(win) = 5.84187654450813

That's the average number of rolls to get a 7 less the average number to get a 7 after you get all the others first times the probability that you get all the others first (since we quit before the 7 in that case).

Your method didn't work because it doesn't account for the times you quit when you get a 7 first, and clearly the average has to be less than 6, the average time to get a 7.

Last edited by BruceZ; 05-18-2014 at 02:36 PM.
Craps Probability Quote
05-18-2014 , 09:38 PM
Quote:
Originally Posted by BruceZ
6 - 6*p(win) = 5.84187654450813

That's the average number of rolls to get a 7 less the average number to get a 7 after you get all the others first times the probability that you get all the others first (since we quit before the 7 in that case).

Your method didn't work because it doesn't account for the times you quit when you get a 7 first, and clearly the average has to be less than 6, the average time to get a 7.
Fabulous! Thanks BruceZ - you're the man! I had myself wrapped around the axle with all the permutations.

Do you have an equally elegant formula for the probability (again without the R program)?

Steen
Craps Probability Quote
05-18-2014 , 10:00 PM
For the probability, you use inclusion-exclusion. The R script does that, but you could do it by hand or in a spreadsheet since there are only 31 terms. You could use any language, though it's helpful to have a combn function that enumerates all the combinations of a given size for some numbers. You should easily be able to find one for Visual Basic. In this post I explain the method for the larger problem of getting the other 10 numbers before a 7, and I go though 5 numbers by hand before resorting to the R script for the rest. I was computing both the probabilities and the average number of rolls which comes from the probabilities. On this page is another explanation of my method by the Wizard of Odds who implemented it with a spreadsheet.
Craps Probability Quote
05-19-2014 , 01:58 AM
Quote:
Originally Posted by BruceZ
For the probability, you use inclusion-exclusion. The R script does that, but you could do it by hand or in a spreadsheet since there are only 31 terms. You could use any language, though it's helpful to have a combn function that enumerates all the combinations of a given size for some numbers. You should easily be able to find one for Visual Basic. In this post I explain the method for the larger problem of getting the other 10 numbers before a 7, and I go though 5 numbers by hand before resorting to the R script for the rest. I was computing both the probabilities and the average number of rolls which comes from the probabilities. On this page is another explanation of my method by the Wizard of Odds who implemented it with a spreadsheet.
Yes, I saw those posts when I was trying to find the avg rolls/dec but it seemed they didn't exactly apply because they count the 7 as another number to make rather than a show stopper. For example, showing 61.2 rolls to make all numbers when I was looking for something in the neighborhood of 5.97 rolls.

The permutation solution I came up with works fairly quick and easy with the All Small and All Tall bets without having to fuss so much with inclusion/exclusion. However, the calculation takes a lot longer when considering all 10 numbers as with the Make All bet and I'd like to find a quicker method. I'll take another look at those posts again and see what I can do.

Really appreciate the help.

Steen
Craps Probability Quote
05-19-2014 , 02:17 AM
Quote:
Originally Posted by Steen
Yes, I saw those posts when I was trying to find the avg rolls/dec but it seemed they didn't exactly apply because they count the 7 as another number to make rather than a show stopper. For example, showing 61.2 rolls to make all numbers when I was looking for something in the neighborhood of 5.97 rolls.
7 was still a showstopper. The 61.2 was the average number of rolls to get all numbers other than a 7 when we win. See my next post for that one. In that case p(win) was the final value of 1-p which was 0.00525770409617443, so you can get your 5.97 the same way

6 - 6*0.00525770409617443 = 5.96845377542295.


Inclusion-exclusion is very fast and just takes a second in R. The method can be adapted for the loaded dice.

Last edited by BruceZ; 05-22-2014 at 01:46 AM.
Craps Probability Quote
05-21-2014 , 07:52 PM
Quote:
Originally Posted by BruceZ
7 was still a showstopper. The 61.2 was the average number of rolls to get all numbers other than a 7 when we win. In that case p(win) was the final value of 1-p which was 0.00525770409617443, so you can get your 5.97 the same way

6 - 6*0.00525770409617443 = 5.96845377542295.


Inclusion-exclusion is very fast and just takes a second in R. The method can be adapted for the loaded dice.
This confused me a bit. The Wizard's page which you referenced steps through each number 2 through 12 (including the 7) so how can it be called the average number of rolls to get all numbers other than a 7?

I believe that the Wizard correctly computes the average number of rolls to achieve all numbers, however, his calculation as structured does not help to find the probability of winning the "Make All" bet (not that it was intended to do so.)

Taking another look at your own post that you referenced, it dawned on me that while you both agree on the final answer of 61.2 rolls to get all numbers, the probability of winning the "Make All" bet can be derived from your calculation because you placed the 7 as the last number to be considered. If one were to place the 4 as the last number, the calculation would reflect the probability of making all numbers before the 4 (a very different value).

I wrote a visual basic routine that runs through all combinations of inclusion/exclusion and came up with the correct answer. It's very short, approx 20 lines, and lightning fast compared to my previous method. I thank you for the enlightenment!

Steen
Craps Probability Quote
05-21-2014 , 09:24 PM
Just one more thing I need to address. The formula you mentioned for the average number of rolls per decision:

6 - 6*p(win)

works great but breaks down when the probability of a 7 is zero. In this case, p(win) = 100% (assuming non-zero probabilities for the remaining significant numbers) and the answer should derive from the average number of rolls to achieve all the other numbers. This is affected not only by the absense of 7's but also the resulting increase in the frequency of the other numbers.

By simulation, I get approx 51 rolls/dec for the "Make All" bet and 37 rolls/dec for the "All Small" or "All Tall" bets. I'm thinking I'll have to enumerate the rolls/dec at the same time that each term is calculated for inclusion and exclusion.

Steen

Last edited by Steen; 05-21-2014 at 09:39 PM.
Craps Probability Quote
05-22-2014 , 01:44 AM
Quote:
Originally Posted by Steen
This confused me a bit. The Wizard's page which you referenced steps through each number 2 through 12 (including the 7) so how can it be called the average number of rolls to get all numbers other than a 7?
Sorry, 61.2 was the average number of rolls to get all numbers in any order, not all numbers without a 7. I did that original computation before I even knew that there was such a thing as a Wynn bet. The only reason I put them in the order I did with the least likely numbers first was so that you could break off the computation early and have an approximation with an upper and lower bound which is how inclusion-exclusion usually works. Then later when someone wanted the probability of winning the Wynn bet, I only had to output the final value of 1-p for the 7 which was already last.

I don't think anyone ever asked for the average number of rolls to get all numbers with no 7 when you win. However, it is easy to use my code to compute that by only changing the 2 lines for E and T. Change them from

E = c(36,36,18,18,12,12,9,9,7.2,7.2,6)
T = 36

to

E = c(30,30,15,15,10,10,7.5,7.5,6,6,0)
T = 30

and that will give you an average number of about 50.9882 rolls, in agreement with your sim. We are computing the conditional expectation given that you do not roll a 7, so instead of 36 rolls to get a 2, it's only 30. Same for a 12. Then for 3, instead of 1/(2/36) = 18, it is 1/(2/30) = 15, etc. Then initialize T to 30 instead of 36 for the first one.

For the all small, in addition to changing E and T, you would need to change the in_36 numbers, and additionally change the for loop to go from 2:length(E) which will work for the other cases as well. Change the parameters to

in_36 = c(1,2,3,4,5,6)
E = c(30,15,10,7.5,6,0)
T = 30

That gives you an average number of about 37.34707 rolls, again in agreement with your sim.

Below I have included code that makes these changes automatically if you just change 1 number for the mode at the top. T is always initialized to the first value of E, so I just do that in one place for all cases.


Quote:
Just one more thing I need to address. The formula you mentioned for the average number of rolls per decision:

6 - 6*p(win)

works great but breaks down when the probability of a 7 is zero. In this case, p(win) = 100% (assuming non-zero probabilities for the remaining significant numbers) and the answer should derive from the average number of rolls to achieve all the other numbers. This is affected not only by the absense of 7's but also the resulting increase in the frequency of the other numbers.
That formula is only valid when the probability of making a 7 is 1/6. If the probability is p for p > 0, it would be

1/p - 1/p * p(win).

When p = 0, then you can compute the average value as I have done with the modified code. The above formula should still be correct in the limit as p-> 0 because you get

lim {p -> 0} 1/p * (1 - p(win))

where 1 - (pwin) -> 0.


Code:
############# Set Mode Here ########################################

mode = 2
# 1 = All numbers
# 2 = All numbers w/no 7
# 3 = All small w/no 7

####################################################################

if (mode == 1) {
    in_36 = c(1,1,2,2,3,3,4,4,5,5,6)
    E = c(36,36,18,18,12,12,9,9,7.2,7.2,6)
} else if (mode == 2) {
    in_36 = c(1,1,2,2,3,3,4,4,5,5,6)
    E = c(30,30,15,15,10,10,7.5,7.5,6,6,0)
} else {
    in_36 = c(1,2,3,4,5,6)
    E = c(30,15,10,7.5,6,0)
}

####################################################################

T = E[1]
for (i in 2:length(E)) {
  p = 0
  for (j in 1:(i-1)) {
    terms = combn(in_36[1:(i-1)],j)
    for (k in 1:(length(terms)/j))
      p = p + (-1)^(j+1) * in_36[i]/(in_36[i] + sum(terms[1:j,k]))
  }
  T = T + (1-p)*E[i]
}

T
1/(1-p)

Last edited by BruceZ; 05-22-2014 at 03:52 AM.
Craps Probability Quote
06-16-2015 , 09:32 AM
I'm
Craps Probability Quote

      
m