Game of Craps
CRAPS problem
For the dice thrower (shooter) the object of the game is to throw a 7 or an 11 on the first roll (a win) and avoid throwing a 2, 3 or 12 (a loss). If none of these numbers (2, 3, 7, 11 or 12) is thrown on the first throw (the Come-out roll) then a Point is established (the point is the number rolled) against which the shooter plays. The shooter continues to throw until one of two numbers is thrown, the Point number or a Seven. If the shooter rolls the Point before rolling a Seven he/she wins, however if the shooter throws a Seven before rolling the Point he/she loses.
> N <- 10000 > x <- sample(6, N, replace = T) > y <- sample(6, N, replace = T) > z <- x + y > sum(z == 7 | z == 11)/N [1] 0.2182 |
22 percent prob that win is possible in the first roll
> results <- data.frame() > condition <- z != 2 & z != 3 & z != 7 & z != 11 & z != 12 > z.c <- z[condition] > for (i in seq_along(z.c)) { + M <- 1e+05 + x1 <- sample(6, M, replace = T) + y1 <- sample(6, M, replace = T) + z1 <- x1 + y1 + temp <- (which(z.c[i] == z1))[1] > (which(z1 == 7))[1] + results <- rbind(results, temp) + } > a <- length(which(results[, 1] == TRUE)) > b <- length(which(results[, 1] == FALSE)) |
> cond.prob <- a/(a + b) > total.prob <- (a + sum(z == 7 | z == 11))/N > print(cond.prob) [1] 0.5913174 > print(total.prob) [1] 0.6132 |
Conditional prob is about 60 percent and the total probability is about 62.7 percent.