BaşlayınÜcretsiz Başlayın

Probability of winning the pass line bet

Now, we'll use the functions that we created previously to simulate 10,000 games of Craps to estimate the probability of winning the pass line bet. The roll_dice and evaluate_first_roll() functions that you previously wrote have been preloaded for you, to be used in this exercise. Recall that the evaluate_first_roll() function takes the shooter's first roll as its input, and determines what should happen after that.

Bu egzersiz

Probability Puzzles in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Perform the shooter's first roll by simulating the rolling of two dice.
  • Using the value of the first roll, determine whether the pass line bet will be won or lost, and store the result into the won vector.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

set.seed(1)
won <- rep(NA, 10000)

for(i in 1:10000){
  # Shooter's first roll
  roll <- ___
  
  # Determine result and store it
  won[_] <- ___
}

sum(won)/10000
Kodu Düzenle ve Çalıştır