Craps

Kanspuzzels in R

Peter Chi

Assistant Professor of Statistics Villanova University

Introductie tot craps

  • Pass line-weddenschap: inzet aan het begin van een ronde
  • Shooter gooit eerst

Eerste worp:

  • 7 of 11: inzet wint
  • 2, 3, 12: inzet verliest
  • Elke andere waarde zet het punt
Kanspuzzels in R

Als een punt is gezet

craps.png

  • Eerste worp shooter: 5 = punt
  • Shooter blijft gooien
  • Als 5 valt vóór 7: pass line-weddenschap wint
  • Als 7 valt vóór 5: pass line-weddenschap verliest
  • Shooter gooit door tot 5 of 7
Kanspuzzels in R

While-lus

roll <- 0

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

Samengestelde voorwaarde in een while-lus

roll <- 0

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

De %in%-operator

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

Laten we Craps spelen!

Kanspuzzels in R

Preparing Video For Download...