play_n_games: Adding the Game to a Loop

Description Usage Arguments Details Value Examples

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

Description

play_n_games(n) add the Monty Hall game to a loop consist of 100 iteration and then tabulate the results of number of wins and loses out of this iteration

Usage

1
play_n_games(n = 100)

Arguments

n=100

Numeric, 100 times iteration

Details

When running simulations, at least we should run the game 100 time to get a result that we can rely on. In this function we simulate the game 100 time, then the function will calculate the probability of winning and loosing according to the contestant choice/strategy (Stay or switch) out of 100 time iteration

Value

a table includes strategy (Switch or Stay), Outcome(WIN or Lose), and the probability of each outcome according to the chosen stategy.

Examples

1

Rami-Assaad/montyhall documentation built on Dec. 18, 2021, 9:52 a.m.