play_game: Play Game - Function

Description Usage Arguments Details Value Examples

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

Description

This function will help to demonstrate which is the best strategy, "stay" or "switch"

Usage

1

Arguments

This

function will allocate variables to store the game setup (create game), a variable to store the initial pick, another one to store the opened doors, another one to save the final pick, another one for the outcome (stay or switch), another variable to save the "strategy", and another for the outcome.

Details

The function will utilize all the previous functions, to create the game, to select the first door, to the host open one door, to the contestant to decides to stay or choose another door. The contestant option will be saved in a variable, also if the contestant's final choice, their strategy, the opened doors numbers and the game outcome.

Value

The function will display the game setup (cars and goats order), the initial selection, the opened doors, the final door selection and the results of the game "WIN" or "LOSE".

Examples

1

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