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))
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 - betline should be applied regardless of a win or loss. (And thebalance <- 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:
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:
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