Skip to contents

Get Sequence of Coin Tosses and corresponding payouts

Usage

coin_toss_seq(
  rounds = 1,
  heads_prob = 0.5,
  starting_capital = 100,
  heads_factor = 2,
  tails_factor = 0.5,
  min_bet = 0,
  max_payout = Inf,
  betting_fraction = 1,
  insurance_payoffs = c(0, 1),
  use_insurance = FALSE,
  insurance_cost = 0.1
)

Arguments

rounds

Number of rounds to simulate

heads_prob

Probability of heads

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

insurance_payoffs

a list of the payoffs for insurance, one for each side of the coin

use_insurance

Whether to use insurance

insurance_cost

Cost of insurance

Value

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

Examples

coin_toss_seq(10, 0.5, 100, 2, 0.5, 1, 1000, 0.5)
#> $results
#>  [1] 100.0000 150.0000 112.5000  84.3750 126.5625 189.8438 284.7656 427.1484
#>  [9] 640.7227 480.5420 360.4065
#> 
#> $payout
#> [1] 360.4065
#> 
#> $toss_results
#>  [1] 1 2 2 1 1 1 1 1 2 2
#>