Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem Script.R
play_n_games(n)
add the Monty Hall game to a loop consist of 100 iteration
and then tabulate the results of number of wins and loses out of this
iteration
1 | play_n_games(n = 100)
|
n=100 |
Numeric, 100 times iteration |
When running simulations, at least we should run the game 100 time to get a result that we can rely on. In this function we simulate the game 100 time, then the function will calculate the probability of winning and loosing according to the contestant choice/strategy (Stay or switch) out of 100 time iteration
a table includes strategy (Switch or Stay), Outcome(WIN or Lose), and the probability of each outcome according to the chosen stategy.
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.