Skip to contents

Perform the coin toss game, given a heads/tails sequence

Usage

get_coin_game_results(
  toss_results,
  starting_capital = 100,
  heads_factor = 2,
  tails_factor = 0.5,
  min_bet = 0,
  max_payout = Inf,
  betting_fraction = 1
)

Arguments

toss_results

A sequence of 1s and 0s, representing heads and tails

starting_capital

Initial amount of money

heads_factor

Factor to multiply bet by if heads

tails_factor

Factor to multiply bet by if tails

min_bet

Minimum bet

max_payout

Maximum payout

betting_fraction

Fraction of funds to bet

Value

A list with the results (list of the payout after each round), toss results (list of coin toss results), and payout (integer)

Examples

get_coin_game_results(1:2, 100, 2, 0.5, 1, 1000, 0.5)
#> $results
#> [1] 100.0 150.0 112.5
#> 
#> $payout
#> [1] 112.5
#>