open_goat_door: Host opens a "goat" door - Function

Description Usage Arguments Details Value Examples

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

Description

In this function the host will be opening a door always (the exception is if the contestant already opened a "car" door). Hence, the door that the host will open is not a "door" car and no the already chosen door by the contestant.

Usage

1
open_goat_door(game, a.pick)

Arguments

Using

the "if" function, the function will open the "goat" or "car" door. If the the first pick was a "goat" the "if" function will choose to open another door. If the first pick was a "car" door then the if statement, will be opening one of the reminding doors.

Details

If the contestant already got a "car" door in the previous function, the host can open one of the two remaining doors. But if the contestant got a "goat" door in the first selection, the host will open a "goat" door. "a.pick" variable will be saving the "goat" or "car" options.

Value

The function could return a door with a "goat" door , or a "car" door depending of the first choice/results. If first door was "goat" then the host door will be always a door with the other "goat"

Examples

1

sandralili/montyhall documentation built on Dec. 22, 2021, 10:14 p.m.