Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
play_game()
plays the entirety of the Monty Hall Problem
game from game creation to determining if the contestant
won or loss.
1 |
... |
no arguments are used by the function. |
The game replicates the game on the TV show "Let's Make a Deal" where there are three doors for a contestant to choose from, one of which has a car behind it and two have goats. The contestant selects a door, then the host opens a door to reveal a goat, and then the contestant is given an opportunity to stay with their original selection or switch to the other unopened door. There was a famous debate about whether it was optimal to stay or switch when given the option to switch, so this simulation was created to test both strategies.
The function returns a data framewith the results of the Monty Hall Problem game. Two columns are created (strategy and outcome) and two rows (stay and switch). This data frame shows whether it was advantegous to stay or switch in a particular Monty Hall game.
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.