Craps

Probability Puzzles in R

Peter Chi

Assistant Professor of Statistics Villanova University

Introduction to craps

  • Pass line bet - wager made at beginning of a round of play
  • Shooter rolls first

The first roll:

  • 7 or 11: win bet
  • 2, 3, 12: lose bet
  • Any other value establishes point
Probability Puzzles in R

When a point is established

craps.png

  • Shooter's first roll: 5 = point
  • Shooter continues to roll
  • If 5 rolled before 7 - pass line bet won
  • If 7 rolled before 5 - pass line bet lost
  • Shooter continues to roll until 5 or 7
Probability Puzzles in R

While loop

roll <- 0

while(roll != 6){
  roll <- roll_dice(1)
  print(roll)
}
5
2
5
6
Probability Puzzles in R

Compound condition in a while loop

roll <- 0

while( (roll != 6) & (roll != 5) ){
  roll <- roll_dice(1)
  print(roll)
}
2
4
5
Probability Puzzles in R

The %in% operator

roll <- roll_dice(1)
if(roll %in% c(2,4,6) ){
  print("The roll is even")
}
"The roll is even"
roll
2
Probability Puzzles in R

Let's play some Craps!

Probability Puzzles in R

Preparing Video For Download...