open_goat_door: Open a door that is not the player's door or car door

Description Usage Arguments Details Value Examples

View source: R/Monty Hall Script.R

Description

This function first determines which goat door should be opened. The door is neither the car door or the player's door.

Usage

1
open_goat_door(a.game, a.pick)

Arguments

a.game

A character vector of length three

a.pick

A numeric vector of length one

Details

This function first determines whether the player chose the car door. If this is true, then a random goat door is selected. if the player did not chose the car door, then the door that is not the player's initial choice and the door that does not contain the car are excluded from the remaining doors. The remaining door is then opened.

Value

This function returns a numeric vector that is the position of the remaining door

Examples

1
2
3
open_goat_door(a.game = c("goat", "car", "goat"), a.pick = 1)

open_goat_door(a.game = c("goat", "car", "goat"), a.pick = 2)

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