#' @title
#' Lets Win a Car!
#' @description
#, This function plays the game and gives you the results
#' @details
#' Tells you if won by staing or if you won by switching . The victory is the car
#' @param ... no arguments are used by the function.
#'
#' @return all the functions to run the game and splits the results
#'
#' @examples
#' play_game()
#' @export
play_game <- function( )
{
new.game <- create_game()
first.pick <- select_door()
opened.door <- open_goat_door( new.game, first.pick )
final.pick.stay <- change_door( stay=T, opened.door, first.pick )
final.pick.switch <- change_door( stay=F, opened.door, first.pick )
outcome.stay <- determine_winner( final.pick.stay, new.game )
outcome.switch <- determine_winner( final.pick.switch, new.game )
strategy <- c("stay","switch")
outcome <- c(outcome.stay,outcome.switch)
game.results <- data.frame( strategy, outcome,
stringsAsFactors=F )
return( game.results )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.