Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
This part of the game setup deals with assigning variables to the door number opened. The variables are two goats and a car.
1 | open_goat_door(game, a.pick)
|
The |
open_goat_door function calls upon the arguments game and a.pick. The door function takes in the logical vectors 1-3. If statements evaluate the game and a.pick arguments and assign the output to functions goat.doors and opened.door |
In this portion of the game, the host will always open a door with a goat behind it. But it cannot be a door the contestant has already selected. So it must be a door that is not a car and not a current contestant selection.
Note: If the contestant selects the car on the first guess, the host can open either door left remaining. But if the contestant selects a goat, the host only has one option, to open the remaining goat door since the host will always open a goat door.
The return would be a logical vector, an integer, between 1 and 3.
1 2 3 4 | 1
2
3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.