Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
determine_winner()
returns the "WIN" or "LOSE" game result.
1 | determine_winner(final.pick, game)
|
final.pick |
Numeric vectors, length 1, between 1 and 3. |
game |
character vector, length 3, any combination of one "car" and two "goat". |
If the contestant's final selection contains the car, they win. The function will return "WIN"; otherwise they lost/ if a goat behind their final door selection. The function will return "LOSE" for this scenario.
The function returns a length 1 character vector indicating the game result.
1 2 3 4 5 6 7 8 9 | determine_winner( 1, c("goat","goat","car") )
determine_winner( 2, c("goat","goat","car") )
determine_winner( 3, c("goat","goat","car") )
determine_winner( 1, c("car","goat","goat") )
determine_winner( 2, c("car","goat","goat") )
determine_winner( 3, c("car","goat","goat") )
determine_winner( 1, c("goat","car","goat") )
determine_winner( 2, c("goat","car","goat") )
determine_winner( 3, c("goat","car","goat") )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.