Previously, I've asked a question related to this.

But now I need to know what if there are multiple chances of winning with different scaling multiples.

The goal is still to double the original money.

Starting balance: $2,500

Starting bet: $1

On loss, increase each bet by 40%.

On win, reset bet amount.

As mentioned before, there are multiple chances of winning, with different multipliers.

Below is the win chance and win amount:

0x - 80.31447937

3.5x - 14.71022253

8x - 4.23654409

13x - 0.67893335

63x - 0.05747584

500x - 0.00230930

800x - 0.00003539

1000x - 0.00000012

Hopefully, this video makes more sense.

So, it depends on how many squares you land on. But those are the odds I listed above.

Would something like this be possible? I'm trying to code in R to simulate this but I'm not sure if it is correct. I would really appreciate any help. Thank you.

Here's my code:

compute_chances <- function(starting_balance, starting_bet, 
loss_increase, win_multipliers, win_chances) {
  balance <- starting_balance
  bet <- starting_bet
  while (balance > 0 && balance < 2 * starting_balance) {
    outcome <- sample(names(win_multipliers), size = 1, prob = win_chances)
    balance <- balance - bet + bet * win_multipliers[outcome]
   if (outcome == 0) {
     bet <- bet * (1 + loss_increase)
     } else {
     bet <- starting_bet
  return(balance >= 2 * starting_balance)}

starting_balance <- 2500
starting_bet <- 1
loss_increase <- 0.4
win_multipliers <- c(`0` = 0, `3.5` = 3.5, `8` = 8, `13` = 13, `63` = 63, `500` = 500, `800` = 800, `1000` = 1000)
win_chances <- c(`0` = 0.8031447937, `3.5` = 0.1471022253, `8` = 0.0423654409, `13` = 0.0067893335, `63` = 0.0005747584, 
             `500` = 0.0000230930, `800` = 0.0000003539, `1000` = 0.0000000012)

n_runs <- 10000
successes <- sum(sapply(1:n_runs, function(x) 
compute_chances(starting_balance, starting_bet, loss_increase, 
win_multipliers, win_chances)))
cat(paste("Chance of doubling the original money:", successes / n_runs))
  • $\begingroup$ The code looks like it fits the problem statement, although I find both a bit unusual in that nothing prevents you from betting more money than you have (bet>balance) - not sure if that is intended. Allowing a negative balance will inflate the win rate somewhat, since you can make large bets with close to zero balance and suffer no additional risk. $\endgroup$ May 25 at 14:39
  • $\begingroup$ @NuclearHoagie Hi. May I ask which line of code is that? $\endgroup$
    – Clarity
    May 25 at 15:16
  • $\begingroup$ I assume the intended behavior is to bet the rule-specified amount if possible, and everything you have left if you don't have enough. You need another line at the end of the while loop, "bet <- min(bet, balance)". If the balance is less than the desired bet, bet the balance instead. $\endgroup$ May 25 at 15:31
  • $\begingroup$ @NuclearHoagie Got it, thanks! I've now added it. $\endgroup$
    – Clarity
    May 25 at 15:50
  • $\begingroup$ sum(win_chances) gives $0.99979$ rather than $1$ $\endgroup$
    – Henry
    May 25 at 16:13

1 Answer 1


Why the code incorrectly gives >50% probability of doubling

In the code, it seems that you only subtract the principal of the bet if you lose, but you should subtract it whether or not you win or lose.

The balance <- balance - bet line should be applied regardless of a win or loss. (And the balance <- balance + bet * win_multipliers[outcome] line can also be applied regardless of a win or loss, since a loss is just a 0 multiplier.)

On the Optimal Betting Strategy

Note that your betting strategy is not optimal: the optimal strategy should depend only on your current balance. It need not change based on the history of previous actions. This is because the problem can be modeled as a Markov Decision Process (MDP) where the state is simply the current balance.

Not sure how to find the optimal betting strategy analytically. Maybe there's an easy way, but I am not aware of it. However, we can discretize the problem and solve the discretized problem with value iteration, which will provide an approximate solution and hopefully some intuition for what an exact solution looks like. I did this, discretizing into 10,000 states for 25 iterations of value iteration, and got a solution with 44% chance of doubling the starting value. It's pretty funky looking:

enter image description here

In the chart above, the goal is to reach 10,000. As you can see, the optimal action jumps around and is not a constant amount or proportion of the bankroll. It's extremely irregular. Here's a zoomed-in portion of the plot between 4000 and 4100: enter image description here

I was inspired in this approach by the discussion of Value Iteration and the Gambler's Problem in Section 4 of the Reinforcement Learning book by Sutton and Barto: http://incompleteideas.net/book/RLbook2020.pdf

  • $\begingroup$ I edited the code. Is it correct to combine the two lines into one: balance <- balance - bet + bet * win_multipliers[outcome]? $\endgroup$
    – Clarity
    May 26 at 1:51
  • $\begingroup$ yup, that works! $\endgroup$
    – Kevin Wang
    May 26 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .