# Progressive Betting Strategies Analysis with Markov Chains

If you are a fan of statistics and probability, then you might have a certain affinity for various games of chance. It can be quite fun to, for example, figure out card counting strategies in Blackjack with simulation. It might also be interesting to try to use some machine learning on the basic strategy tables to figure out smaller, easier to learn sub-sets (something that I want to try at some point).

Hopefully you are also aware of the Gambler’s Fallacy. If you have (or think you have) a problem with gambling, don’t be afraid to seek help! Also, never EVER gamble with money that you can’t afford to lose. Always set aside a given amount of money that you are 100% fine with losing all of (because that will happen).

There are excellent sites out there (like Wizard Of Odds) that give excellent information on probabilities and house edges (notice how none are in our favor!). There are also plenty of discussion of strategies (usually about how bad they are). What I was curious about was whether or not some betting strategies were able to increase the probability of making a set profit (and then stopping). Most people don’t go to the casino very often (if at all), so I wanted to find out about short-term behaviors of these strategies, rather than the obvious long-term failure.

Using Markov Chain analysis and Monte Carlo simulation (in the next post), I’m going to examine some betting strategies. The obvious conclusion is “you will still lose everything in the long run”, but there are some interesting twists along the way. I’ve included some code so you can set up your own analyses, too!

### Intro to Betting Strategies

(If you already know about strategies, or just want to look at some results and pictures feel free to skip ahead to the Markov Chain section or farther. The front matter on this post is a bit lengthy!)

Strategies can fall into different categories, depending on what sites or books you read. The category we’ll look at in this post is ‘progressive’ strategies. There are two sites to check out for some summaries (just so I can get right to the math). The first is here, and this is the second one. They are both ok, as far as the logic goes, but there are still some errors. They also include essential disclaimers. Here is one:

As we mentioned earlier, common advice is that progressive betting systems should be completely ignored. We fully understand why people would offer that advice, but [sic: because?] the simple fact of the matter is that they don’t increase your overall chances of winning. However, we believe that using such systems isn’t necessarily something to avoid at all costs.

We’ll get into some circumstances where you might not want to avoid a progressive strategy. Here is a quote with an error:

Many progressions that work in other forms of gambling just won’t work in blackjack.

They don’t work in other forms of gambling, especially in the sense that they will not make you loads of money!

#### The Basic Idea

Betting strategies have the goal of trying to balance out wins and losses, such that wins give you more than your losses. Others (such as the martingale) try to always bet enough such that a win on that bet will overcome any previous losses. The first category is a ‘positive’ strategy, which increases bets as you win. The second is a ‘negative’ strategy, which increases them as you lose. The negative strategy is so bad an idea I won’t even cover it. Chasing your losses is the worse thing you can do.

Positive strategies try to increase bets, but in a way that has you playing with as much of your winnings (and not principal) as possible. This is generally good advice, and strategies are just a way to talk about how you might go about that. In a positive strategy, you drop bets back to some base level after you lose. You should never chase losses.

These kinds of strategies are only recommended for even money games. I haven’t looked at games that pay “X for 1”, like many slots and video poker games. The game examined in this post is essentially playing black in roulette every turn: an 18/38 chance.

#### Some Strategies

Strategies are a dime a dozen, and you can find tons in various books and scam e-book sites. I’ll cover a couple of the simpler ones that can be modeled analytically with a Markov Chain in this post.

For the Absorbing Markov Chains in this post, I’ll cover:

• Constant betting
• Paroli (increase bet by double each win, up to two wins: [1 -> 2 -> 4]
• Increasing (increase bet by one each win, up to some level)
• 1-3-2-6 (see below)

The 1-3-2-6 strategy seems fairly common online. The basic idea is that (and this is a fallacy, of course) two wins in a row are pretty common. A third win in a row is less common, so the risk on the third bet is lower, such that you won’t lose the gains from the first two. The fourth bet (6) will either get you a big win, or drop you back to where you started in the cycle. Here’s a quick rundown of what your bankroll will look like, assuming that you start with 10 units to bet with:

1. Lose on the first bet: 9 units
2. Lose on the second bet: 8 units (bet 3 with 11)
3. Lose on the third bet: 12 units (bet 2 with 14)
4. Lose on the fourth bet: 10 units (bet 6 with 16)

You have to get through two wins in a row with the cycle for it to turn a profit. The idea is that you’ll win two in a row about as much as you win one then lose 1 (again, see the fallacy). If you win two in a row, you make 2 units. If you lose the second, you lose two units. The strategy seems to be all about building small winning pots and then betting big with the winnings.

### What I Want to Learn

I have never gambled before, and I’m not really keen on the idea. I’ve never had enough disposable income to even consider a large enough bankroll to provide enough time in a casino to consider it an ‘entertainment’ expense. I doubt I’d even play enough to get even the most basic comps.

That’s why these betting systems interest me. Not because I think they are foolproof ways of winning (they are not!), but because I’m wondering what impacts they have on short-term play with moderate bankrolls and times in a casino. If I were to go to casino, I would want several things to happen. First, I’d like to play a while and not lose too quickly. Secondly, knowing that I’m 100% certain that losing all my money is acceptable, I’d like to set a winnings goal that gives me a decent shot of reaching that goal (at which point I walk away) in some time frame.

For this post I will look at the following scenario:

• Betting black on roulette (18/38 = 47.37% chance of winning even money)
• A decently crowded roulette table (55 spins per hour)
• I am bringing 100 units, and betting 1 unit minimum
• I will play until: 3 hours, lose everything, or gain above 50 units.

### The Markov Chains

It’s simple enough to make Markov Chains for those strategies and my casual gambling scenario. The states in the chain are combinations of the size of the bankroll and the amount bet previously. The absorbing states are the losing and ‘winning’ state. I’ll handle the time played with the number of spins in 3 hours (165 spins), which is just the number of steps to run the chain out to. I’ll also look at the long-run behavior of the chains, since there are some interesting conclusions out there.

Let’s do a quick example of a state transition in a chain. If we are doing the 1-3-2-6 strategy, we start at state (100, 0). Our first bet is 1, and then we’ll either go to (101, 1) or (99, 0). 1 represents that we bet 1 and won, 0 means we lost. From (101, 1), we can go to (104, 3) or (98, 0), etc. When we get to or above 150, everything is absorbed in a ‘WIN’ state. The same is true for going bankrupt.

#### The Long Run

Absorbing Markov Chains have very easy to calculate long-run properties. The probability of being in any absorbing state is found from the following math, with the transition matrix given as $P$. We break $P$ up into 4 matrices:

$P=\left(\begin{array}{cc}Q&R\\\mathbf{0}&I_{r}\end{array}\right)$

The $Q$ matrix is a matrix that gives only the transition probabilities of the non-absorbing set. Using that matrix, we can get a matrix that tells us how many visits in each non-absorbing (transient) state we can expect. That is the $N$ matrix:

$N=\left(I_t - Q\right)^{-1}$

There are other matrices and interesting results that we’ll get. The most important one, though, is the $B$ matrix, which gives the probabilities of being absorbed. We find that with:

$B=NR$

For more of the math and explanations, see the fairly decent wiki page.

For each strategy I found the probability of being in each state, the expected value of the long run, the expected number of turns until absorption, and the standard deviation of those number of turns. Here are the results (rounded):

 Pr(Win) Pr(Lose) EV E(turns) Std(Turns) Normal 0.01 0.99 0.77 1885.31 815.20 1-3-2 0.08 0.92 12.70 983.40 588.88 1-3-2-6 0.16 0.84 23.47 747.98 489.42 1-2-4 0.10 0.90 15.15 961.38 585.03 Increase to 10 0.17 0.83 25.03 748.35 470.10

#### Long Run Conclusions

The normal strategy (no increase in bets) gives the obvious result that it will take a very long time to reach the WIN or LOSE states (about 33 hours). It also has a very poor expected value, because it’s not increasing bets to even try to gain an edge. If you make the same bet over time on a losing game, you have a very very low chance of winning.

The 1-3-2 strategy (I was curious if not going all in on the 6 mattered) provides a better expected value, but it’s still a losing EV! The number of expected turns to finish is also high. ~1000 roulette spins would take about 18 hours.

For the 1-3-2-6 strategy, we have a pretty good expected value (relative to the others). The strategy has the ‘win big, but lose as big probably more’ property, which is seen in the low number of expected turns to finish. The other strategies are pretty similar as well. What seems apparent is that the strategies buy us variability in the results, and sometimes that catches our goal and we quit (more on this later!).

I was surprised at the ‘effectiveness’ of the increasing bet to 10 strategy. Although I suppose it is just a ‘win big, lose big’ strategy, just without all the funny business of thinking about 1-3-2-6. It also takes advantage of winning streaks, because you start risking less and less of your winnings by percent, but still pushes your betting higher. You have to make it through three steps, though, to have a chance at a profit.

### The Short Run

To analyze the short run, we just go back to the basic Markov Chain math of taking the power of the transition matrix, and multiplying that by the initial state distribution. The power is the number of turns I am willing to take (3 hours at 55 spins an hour).

For the short run, I’ll duplicate the above table, but add some new probabilities. There will be probabilities of having no money, having at least half the starting money, the probability of having a profit, and the probability of reaching the goal. We can get these probabilities because we haven’t completely absorbed yet.

I’ve also calculated the expected value of the profit (given that we earned a profit) and the expected value of the loss (given that we lost money). The losses are written as negative, even though the expected amount of losing implies it.

Here is the table of results (rounded to 2 decimals):

 Pr(Bankrupt) Pr(> Half) Pr(Profit) Pr(Goal) EV E(profit) E(loss) Normal 0.00 1.00 0.26 0.00 91.84 1.92 -10.08 1-3-2 0.00 0.94 0.27 0.01 86.26 4.13 -17.87 1-3-2-6 0.00 0.89 0.28 0.04 84.35 5.59 -21.24 1-2-4 0.00 0.94 0.27 0.01 86.41 4.41 -18.00 Increase to 10 0.00 0.93 0.25 0.06 84.90 5.50 -20.59

Given my objectives above, playing for 3 hours isn’t likely to break the bank at all. The probability of earning a profit is fairly constant, but it’s the probabilities of having more than half our money that shift the most. In the long run, the 1-3-2-6 strategy and the Increase to 10 strategy looked similar. In the short run, increasing to 10 is similar to 1-3-2-6 in profit, but has a better chance of keeping us above 50% of our earnings. The best chance of meeting our goal is given by the ‘increase to 10’ strategy, so if we want a better chance of coming out ahead, the increase to 10 strategy is probably better.

#### Distributions of Results

Let’s visually compare the 165 turn outcomes from the 1-3-2-6 and the 10 strategies to see what’s happening.

Notice how the 10 strategy is skewed more to the left, but since it bets much higher, it’s been absorbed a few more times than the 1-3-2-6. We can check that this is what is likely happening by plotting the 10 strategy against itself for 2 hours and 3 hours worth of play:

As we expected, the distribution begins skewing heavily left (as they all will, to some extent).

### EV Drop Offs

In the long term, EV of each strategy will drop off as a function of the number of turns. We can plot that EV drop off for each strategy and draw some conclusions:

For low numbers of turns, playing normally gives the best expected value (keeping in mind that lower EV tends to mean higher variability, or luck in meeting goals). In the long run, though, a betting strategy with a goal is the only way to not have a 0 expected value. The next sections show some more sensitivities along this line.

### Sensitivity to Probability

The strategies’ outcomes are very sensitive to the probability of winning, as shown in the following chart. Even decreasing your odds of winning from even to 3% below even can drastically decrease your chances of a profit.

It’s about a loss of 7% profitability chance for every 1% of win probability lost. The Pass bet in Craps (at 49.29% winning odds of even money) might be a better bet. Being nearly 2% higher than the best Roulette even money bet, it will offer us almost a 14% increase in chance of profitability.

Notice how the normal betting strategy becomes more appealing as the odds approach even, at least in terms of the profitability chance. If we look at the probability of reaching our goal, though, the situation is a bit different:

Here, no matter what, we’re not likely to reach our win goal of 50 additional units in 155 turns. To do that, we’d need twice as many wins as losses (an actual win rate of 2/3), and the probability of getting 103 wins or more is 5.67e-07 (for roulette)! For a 50% win probability, the probability of reaching our goal is 1.25e-05.

### Sensitivity to Goal

The goal also matters, as a larger goals means that we are giving ourselves more opportunities to let the long-run kick in (ruin!). The same two charts as above are reproduced, but for varying goals.

Notice how incredibly important setting a reasonable goal is. The greedier we get, the less likely we are to end up doing well. Strategies are ways to try to exploit luck, if it happens. If luck doesn’t go our way, we go back to low bets. In the long run, this will always lose. With smalls goals over a short time period, though, we give ourselves some chances to walk away happy.

### Conclusions

Hopefully you’ve seen how betting strategies (at least these) don’t give you any hope in the long run. Sure, you might have a 16% chance of reaching your goal in the long run, but remember the key here! The key is to have a goal and know when to stop. The only reason that these strategies appear to give us some chance is because we’ve established up from that we are willing to walk away with some profit and call it a day. If we get greedier, and move that ‘goal’ out farther and farther, the probabilities of ruin will grow quickly to 100%.

Even playing for 3 hours gives a losing expected value of the final bankroll. The key (for me) is that the losing expected value might only be 15 dollars.  If I wanted to kill 3 hours in a casino, taking in the environment, playing some even money games to enjoy myself, and expected to lose a movie ticket price on average (and have > 90% chance of keeping \$50), then one of those betting strategies might be worth using!

So, like those other sites I linked say, a progressive strategy could be enjoyable for a well-disciplined player who is willing to lose their entire bankroll. The strategies, by going for a “win-big, lose-not-as-big” attempt can increase the stakes and adrenaline for the responsible player. In the 1-3-2-6 strategy, the pressure is on for the second bet. If you win that one, you’ve set yourself up with some winnings that you can use to push the odds and try to grow your bankroll.

Please, though, always play responsibly! If you’re going to play, stick to the strategy. Don’t engage in the gambler’s fallacy. The math gives you the expectations. You’ve already decided that those expectations are fine for you, so don’t leave them behind and get cocky!

### Appendix: Code

To follow my work, use the following code to generate the state transition matrices. Everything else follows the math I outlined. This first block gives a function that creates a progressive strategy. (I also wanted to try out closures in Python, since I hadn’t ever had a use case for them).

def prog_strategy(bet_prog):
bet_prog2 = list(bet_prog)
bet_prog2.append(bet_prog[0])
def strategy(x):
if x not in bet_prog2:
return 1
ind = bet_prog2.index(x)
return int(np.floor(bet_prog2[ind+1]))
return strategy


When you define a progressive strategy, you input a list like [1,3,2,6]. The code doesn’t work with repeating values, but I ended up fixing that for some later work. This code suffices for now, and you can see how it works and interacts with the Markov Chain states.

The next block gives an example of how to make states and the rules for the 1-3-2-6 strategy. Each state is a tuple of the bankroll and the last bet made. 0 means a loss, so that the strategy knows when to restart. The other entries in the states correspond to the previous bets made. An alternative would just be to use an integer the represents the position in the sequence of the bets (I ended up switching to this for simulations, but not my Markov Code). Doing so would remove the problem

states = []
for i in xrange(1,goal):
for j in [0,1,2,3,6]:
states.append((i,j))
states.extend(['WIN','LOSE'])
s1326rule = prog_strategy([1,3,2,6])


The rule and the states get input into the following function, which generates a dictionary of state transitions:

def make_trans(states,rules,goal,p=18/38):
q = 1-p
state_trans = {}
for s in states:
if s == &quot;WIN&quot; or s == &quot;LOSE&quot;:
state_trans[(s,s)] = 1
continue
# get all the states that this one can go to
bet = rules(s[1])
win_amt = s[0]+bet
if win_amt &lt; goal:
win_state = (win_amt,bet)
else:
win_state = &quot;WIN&quot;
lose_amt = s[0]-bet
if lose_amt &gt; 0:
lose_state = (lose_amt,0)
else:
lose_state = &quot;LOSE&quot;
key = (s,win_state) if win_state != &quot;WIN&quot; else (s,&quot;WIN&quot;)
if key not in state_trans:
state_trans[key] = p
key = (s,lose_state) if lose_state != &quot;LOSE&quot; else (s,&quot;LOSE&quot;)
if key not in state_trans:
state_trans[key] = q
return state_trans


We feed that into the ‘get_chain’ function to build a numpy matrix of our state transitions:

def get_chain(state_trans,states):
P = np.zeros((len(states),len(states)))
for (s1,s2),p in state_trans.items():
i = states.index(s1)
j = states.index(s2)
P[i,j] = p
return P


From there, use the P matrix in the ways that the math says to and you’re well on your way.