game: Monty Hall Simulation

Description Usage Arguments Details Value Examples

View source: R/Monty Hall Script.R

Description

game() returns the probablity of winning while staying or switching doors. The user is able to determine how many doors they would like to use by determining the amount of goats and cars.

Usage

1
game()

Arguments

...

This function does not take any arguments

Details

This is a function is a form of the famous gameshow "Let's Make a Deal" that was presented by the famous Candian gameshow host Monty Hall. The original game consisted of three doors where two doors concealed goats and one door concealed a car. The player was asked to chose a door in hopes that it was the car. Once the door was selected, Monty Hall would then reveals one of the goats. This leaves the player's door and another door. The player is then given the option to either keep their initial door or switch with the remaining door. This simulation tests whether a player increases their odds by switching doors or staying with their initial door.

Value

The function will first ask the player to enter the number of goats and cars. Then the function will return the probability of winning if a player choses to stay or switch.

Examples

1
game()

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