determine_winner: Contestant is determined either a winner or not.

Description Usage Arguments Details Value Examples

View source: R/monty-hall-problem.R

Description

‘determine_winner' uses the contestant’s final door pick along with the knowledge of where the car is to generate whether the contestant won or lost.

Usage

1
determine_winner(final.pick, game)

Arguments

'final.pick'

- This is the contestant's final door choice, represnted by the number 1 through 3. 'game' - This is a dataset that holds the order of where the two goats and one car are.

Details

The function uses if statements, along with the passed paramenters of the game setup and the final pick. It checks to see if the conetsant's final pick was the car or the final goat. If it is the car, it returns thjew string 'WIN'. If it was the goat, it reuturns the string 'LOSE'.

Value

The function returns either the string 'WIN' or 'LOSE' based on whether the contestant chose the door with the car or the door with a goat.

Examples

1
2
  determine_winner( final.pick.stay, new.game  )
  determine_winner( 3, c("car", "goat", "goat"))

Vodkard/montyhall documentation built on Feb. 27, 2020, 12:42 a.m.