create_game: Montyball

Description Usage Arguments Details Value Examples

View source: R/montyhall.R

Description

play_game(x,y,z) returns the strategy and outcome for x number of doors, in which y number of goats and z number of goats. x=y+z.

Usage

1
create_game(doornumber, goatNum, carNum)

Arguments

x

Numeric. Number of doors in the game.

y

Numeric. Number of goats behind the doors. There are at least 2 goats behind the doors.

z

Numeric. Number of cars behind the doors. y+z = x and there is at least on car in the game.

Details

This function is a combination of a few different subfunctions: create_game, select_door, open_goat_door, change_door and determin_winner. create_game: It starts up the game and returns x number doors, with randomly assigned positions for y number of goats and z number of cars. select_door: It retruns the first selected door number which is randomly created by the function??? open_goat_door: It reveals a goat for the host. change_door: makes your final pick depending upon if you intend to stay or switch. determin_winner: decides if you win the car or not.

Value

strategy and Outcome for the game. The function returns a dataframe which includes strings and numbers.

Examples

1
2
3
4
5
6
7
play_game(10,1,9)
play_game(10,8,2)

## Not run: 
play_game("x",'y','z')

## End(Not run)

monkeyking01/MontyHall documentation built on Sept. 7, 2020, 12:36 a.m.