# Is it a valid algorithm to win at the casino roulette?

I would like to try the following algorithm in order to win in the roulette:

1. Be an observer until there are 3 same parity numbers in a row ($0$ has no defined parity in this context)

2. Once there were achieved 3 numbers with the same parity in a row: init $factor$ to be $1$

3. Bet the next number will be the opposite parity if you were wrong double $factor$ and return 3 else goto 1.

Here is a python code for it - which bring profit all the time:

import random

nums = range(37)
bank = 10**10
games = 3000
factor=1
bet_amount=100
next_bet = None
parity_in_row ={"odd":0, "even":0}

for i in xrange(games):
num = nums[random.randint(0,36)]

if next_bet == "odd":
if num % 2 == 1:
bank += factor*bet_amount
factor = 1
next_bet = None
else:
bank -= factor*bet_amount
factor *= 2
elif next_bet == "even":
if num % 2 == 0:
bank += factor*bet_amount
factor = 1
next_bet = None
else:
bank -= factor*bet_amount
factor *= 2

if num > 0 and num % 2 == 0:
parity_in_row["even"] += 1
parity_in_row["odd"] = 0
elif num % 2 == 1:
parity_in_row["odd"] += 1
parity_in_row["even"] = 0
else:
parity_in_row ={"odd":0, "even":0}

if parity_in_row["odd"] > 2:
next_bet = "even"
elif parity_in_row["even"] > 2:
next_bet = "odd"
else:
next_bet = None

print bank

• If I did the calculation correctly the probability to have 4 numbers in a row with the same parity $< (1/2-\epsilon)^4$ [where $\epsilon < 1/36$ is a compensation for the probability to achieve $0$].
• Keep doubling $factor$ ensures you will have positive expectation, right?
• Isn't the probability of getting odd number is $0.5$ ? since $Prob(odd | even, even, even) = \frac{1}{2}$ ?

Please try to supply a rigorous proof why it is wrong, and try to explain why my python code always return with a positive outcomes

• Unless you have infinite money, and the casino has no bet limit, this strategy is guaranteed to lose in the long run. The only way -- the only way -- to make money off roulette over the long term in a casino is to be the casino. Everything else, no matter how convoluted, is a sucker bet. If you enjoy playing, then play low stakes and treat the losses as the ticket price for that enjoyment. If you don't particularly enjoy playing, find investments with positive expected return instead. – Glen_b May 27 '14 at 8:15
• This (famous) class of strategies is a very refined way to go broke fast. Sending me $100 a month is less refined, but will send you broke so much more slowly that it will seem profitable by comparison. – Glen_b May 27 '14 at 8:24 • In your code, you forgot the cases where the number is neither odd nor even. Depending on the location you are playing in, there will be either one or two 0's on the wheel and these are counted as neither odd nor even. – Peter Flom May 27 '14 at 10:08 • The only way to win at roulette is by using physics. I have designed an app basing on a pdf's equations, that works. At leas it works for predicting from the 10-8 las revolutions and on. It does not from the initial turns of the spin though. I am still trying to figure out why, and to improve it. Drop by my post if you're interested in this: physics.stackexchange.com/questions/346753/… (There is the link to the pdf I used) – BlueMath15 Jul 21 '17 at 10:46 • Combining the gambler's fallacy with the martingale betting strategy... brash! – Alexis Feb 13 '18 at 5:38 ## 4 Answers You have discovered the Martingale. It is a perfectly reasonable betting strategy, which was played by Casanova and also by Charles Wells, but unfortunately it doesn't win in the long run. Essentially the strategy is no different from the following idea: Keep betting. Each time you lose, bet more than your total losses up to now. Since you know that you'll eventually win, you will always end up on top. Your plan of only betting after getting three the same in a row is a red herring, because spins are independent. It makes no difference if there have already been three in a row. After all, how could it make a difference? If it did, this would imply that the roulette wheel magically possessed some kind of memory, which it doesn't. There are various explanations for why the strategy doesn't work, among which are: you don't have an infinite amount of money to bet with, the bank doesn't have an infinite amount of money, and you can't play for an infinite amount of time. It's the third of these that is the real problem. Since each bet in roulette has a negative expected value, no matter what you do, you expect to end up with a negative amount of money after any finite number of bets. You can only win if there is no upper limit to the amount of bets you can ever make. For your last question, the probability of getting an odd number on a real roulette wheel is actually less than$0.5$, because of a 00 on the wheel. But this doesn't change the fact that you have discovered a nice winning strategy; it's just that your strategy can't win (on average) in any finite amount of bets. • I am looking on events which are sequence pf at least 4 events. where 3 of the first are identical. – 0x90 May 27 '14 at 13:52 • Actually, Martingale always win in the long run, as long as you have infinite money to keep double your bet with. – KoKo Mar 6 '16 at 22:19 • "ok my next bet will be pi" – frcake Oct 18 '17 at 22:51 • Doesn't "Your plan of only betting after getting three the same in a row is a red herring, because spins are independent." contradicts this answer: math.stackexchange.com/a/1111648? – 0x90 Jul 24 '18 at 23:32 You missed the fact that your calculation refers to the prior probability of four same-parity numbers in a row, whereas at the moment when you place your bet, you have already observed three of the numbers, hence the probability you are betting on is either the conditional probability of an odd number given that the three previous numbers were odd or the conditional probability of an even number given that the three previous numbers were even. If you compute that conditional probability correctly, you should find that it is equal to the prior probability that any given spin of the wheel will come up odd (and also equal to the probability that it will come up even). The rest of your system appears to consist of a double-or-nothing strategy. If you start with a large enough pile of money (for example,$10^8$times your initial bet, as shown in your Python code), and you play not too many games (only 3000 in your example), the chances are quite good that this strategy will "work". But if you are very unlucky, or if you play long enough, you will hit such a bad streak of losses that you will not have enough money left to double your bet after the last loss, and the strategy fails. In effect, you are risking the loss of 5 to 10 billion units of money in return for a non-quite-certain chance to win 300,000 units of money. At only 3000 games in each run of your simulation, it may take quite a few runs before you encounter a disastrous outcome, so after a limited number of simulations it may appear to you that this system works well. But that would only be because you haven't done enough trials to correctly discover the risk. Looks like everyone already told you this-- But, surprisingly enough, each bet in Roulette has the exact same odds to payout ratio, or expected value (EV). That EV is negative (house edge). So red, black, columns, numbers -- all the same expected return, with the exception of the "sucker's bet" pentagon, which has slightly worse EV than any other bet. Your system is a combination of believing the roulette wheel has a memory (the 'hot' and 'icy' numbers graphics in Roulette wheels in Vegas are meant to entice suckers with 'systems' that don't work). It doesn't. You also throw in the Martingale system -- which goes like this. Make a bet -- if you lose, make a larger bet that covers all your losses. Play until you win one time. The problem with this is that, given you have finite money, and the house has a max bet limit (it does) --- you WILL, at some point, accomplish the unlikely but inevitable feat of losing 8 or 9 times in a row (going from one bet to the max bet) -- and losing a metric S$@! ton of money.

Ultimately, the house has about a 5% edge in Roulette. That means long term, you will average a 95% return on every bet placed on the wheel.

So a bet of 1000 in the long term average out to 50 lost per bet.

The more bets you make, the more statistically certain this is.

So any system, like the Martingale, that throws increasingly larger sums on the table, averages out to lose increasingly higher amounts overall.

• I am working on events of 4 spins – 0x90 May 27 '14 at 16:24
• If you really believed in this, I'm surprised you'd be publishing it to the masses. But regardless, it doesn't matter that 4 spins went red in a row. It doesn't matter if there are 99 spins in a row that went red --- the next one has the exact same odds -- almost exactly 50% chance of red, almost 50% chance of black, minus the zeroes. – user45867 Jun 2 '14 at 16:02
• I did believe and lost some money, the question is why within the script the outcome is always higher than the initial money in the bank? secondly why if I ask you what are the odds to have 4 blacks in a row is about $(1/2)^4$ and that doesn't hold in my case. – 0x90 Jun 2 '14 at 16:29

My level is too low to comment BUT I can post this answer so here it goes.

I see all of you spamming about finite bets and finite money. However, if we do the maths regarding ONLINE roulettes. I came to the following conclusion.

If you have a starting budget of 20000, the actual chance of losing is very small (not impossible though, but I guess that impossible doesn't exist in statistics). Here's why:

All rolls are completely independent of eachother. The example i'm using has 15 numbers, 7 red, 7 black, 1 green. This effectively means that you have around 46% chance of winning if you bet on red or green.

Now follow me into some maths. The chance to lose this throw and the next is those two chances multiplied (basic). Your chance to lose is 0.54, so your chance to lose twice in a row is 29%. Now if you keep going like this, let's look at the possibility you'll lose 10 times in a row. this effectively means 0.54^10. We see that this chance is only 0.2%. If the minimum bet is 1, that means (using Martingale of course) you need a minimum of 1023 to be able to bet 10 times on the same color, doubling your bet.

If you take it even further (saying 13 times not your color in a row), you have 0.03% chance it actually happens and that's something I think we can call statistically negligeable. So that kinda almost solves the finite money stuff.

Regarding the finite time, some sites offer you an autobet feature. I recommend using that. And for god sakes, don't turn that autobet off when you lose some rounds. Chances are that next round is your round.

(I know that 0.03% is still a chance to lose. But as you win and earn more money, you'll be able to take on longer 'trains' and eventually this chance will go to its 0 limit.)

Just keep in mind, the house always wins.

Small sidenote: i'm only talking about online roulettes and I've only played one so far. So the possiblities of me being wrong are pretty big. Just please correct me if i'm wrong.

EDIT: As commented, there were no real equations although i'm talking about maths. So I'll explain quickly (without too much depth) how I reached certain numbers.

You have 46% of winning, this is because you have 7/15 chance to win (because all numbers are equally distributed). So 7/15 ≈ 0.46, which means 46%.

As I said, the chance of losing two rounds in a row is basic Maths. Knowing the fact that two rounds are completely independent of each other, we can just multiply the odds and see the possible chance to lose. (Note that the chance to lose 1 round is ca. 54%). This effectively means 0.54*0.54=29.16%.

Going even further, the chance you lose 10 rounds in a row, would be: 0.54*0.54*0.54*0.54*0.54*0.54*0.54*0.54*0.54*0.54=0.54^10=0.00210 or 0.21%.

And of course, the further you go, the less chance you have. Taking the 13 rounds example: 0.54^13=0.0003319 or 0.033% chance you'll lose.

But keep in mind that you'll have to use the martingale system of course, otherwise you'll lose. This means you will need a large enough starting balance, to be able to avoid those nasty trains.

• You say follow the math, but I can't see equations. You can also use my code above to demonstrate your points. Also I am not sure what's your suggested algorithm. – 0x90 Jan 25 '18 at 12:05
• I'm sorry, i"ll edit my answer to include the mathematic equations I used. – Matthias Raes Jan 26 '18 at 10:33
• you can use $signs to put the math inside it. To format your post. – 0x90 Jan 26 '18 at 12:50 • I think your analysis is incorrect, as mentioned by others. Each event is independent (that's our assumption). – 0x90 Jan 26 '18 at 15:36 • oh I didn't know about the$ sign. Anyway, my analysis is entirely based upon the fact that all events are completely seperate from each other. In the calculation of chance, it makes a huge difference if the events are related or not (e.g. a box with white and red balls, if you take a red one, the chance for a white one increases). In the case that the events are related, you cannot use the formula's I have implemented in my analysis. However, when using this "technique", it is very important that you search for an optimal "max bet". – Matthias Raes Jan 27 '18 at 21:23