determine_winner: Determine whether the final door is a winner

Description Usage Arguments Details Value Examples

View source: R/Monty Hall Script.R

Description

This function returns whether or not the player's final door choice contains the car or a goat. If the door was concealing the car, the player wins. If the door was concealing a goat, the player loses.

Usage

1
determine_winner(final.pick, this.game)

Arguments

final.pick

A numeric vector of length one.

this.game

A character vector of length three.

Details

This function checks whether final door number is equal to the position of the car in the game. If yes, then "WIN" is returned. If no, then "LOSE" is returned.

Value

This function returns whether or not the player won or lost.

Examples

1
2
3
determine_winner(final.pick = 1, this.game = c("car", "goat", "goat"))

determine_winner(final.pick = 2, this.game = c("goat", "car", "goat"))

dlyork/montyhall documentation built on Jan. 31, 2021, 7:22 p.m.