open_goat_door: Open a Goat Door

Description Usage Arguments Details Value Examples

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

Description

1
2
3
 opens a door not selected by the contestant
 or a car to reveal a goat. This leaves 2 doors
 unopened

Usage

1
open_goat_door(game, a.pick)

Arguments

arguments

in this function are: game: randomly assigns goat, goat, and car to doors 1,2,&3 a.pick: randomly assigned integer of 1,2, or 3 as the contestant's first pick

Details

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 this function first checks if the contestant's
 pick is a car by using an IF statement.
 If the contestant has selected the car then the
 function will randomly select one of the remaining
 doors to reveal a goat.

 If the contestant has selected one of the two doors
 with a goat, the function places a number (1,2,or3)
 that does not contain car or the contestant's pick
 into opened.door

Value

1
2
3
4
5
 goat_door will return a number that is not assigned
 to the car or to the contestant. the number will reveal
 a goat.

 the number will be placed in goat.door

Examples

1
2
3
4
     returns one of the following:
     [1] 1
     [1] 2
     [1] 3

AmyTrumpower/montyhall documentation built on Dec. 17, 2021, 8:47 a.m.