Locklin on science

On beating roulette: part 3

Posted in econo-blasphemy, Gambling systems by Scott Locklin on March 14, 2016

This is third in a four part series. Part 1 here, part 2 here.

Picture 12

To my mind, the most mathematically interesting thing about roulette is the betting system you should use to maximize your wins. Bet sizing systems are important in all probabilistic games, and the types of lessons learned from a winning game of roulette are the same types of lessons you need to learn in betting on other things, like success in trading, or having an edge on the wiener dog races. The nice thing about a game of roulette is it is relatively easy to characterize your edge. Most people’s edge over the roulette wheel is negative, so you should not bet. If you built one of the computer gizmos I went over in part 2, you have a positive edge over the roulette wheel.

We know from results in information theory, that sequential bets in the presence of an edge should be sized according to the Kelly Criterion to maximize bankroll growth rate.

betsize = \frac{bankroll * edge}{house odds}

or, in more probabilistic terms;

betsize = \frac{p * odds + p -1}{odds}


where p is probability of success.

It’s probably not immediately obvious why this is so, but consider a biased coin toss at even odds ($1 payoff for $1 bet). If your coin’s edge is 100%, you gain money fastest by betting your whole bankroll. If you have 0% edge, you shouldn’t bet anything. If you have a 1% edge, you should bet 1% of your bankroll.

Daniel Bernoulli came up with the same fraction a long time before by maximizing the geometric mean.

Kelly’s original paper figured this out by modeling how a better would place bets assuming he had insider information transmitted over a noisy wire transmitting a binary code; a beautiful way of thinking about predictions in the presence of noise. Kelly is a guy I wish had lived longer. He dropped dead at the young age of 41; in his short life he was a Naval aviator in WW-2, invented computer speech synthesis, made huge contributions to information theory, mentored important mathematicians (Elwyn Berlekamp, who went on to found Axcom/Rentech, based in part on Kelly’s insights) and had the kind of life that would be considered hyperbole if he was in a science fiction novel.  They make big men in Texas. Kelly was a giant.


I’m pretty sure his testicles smoked unfiltered camels

I’ve been known to take sadistic glee in making fun of economists. One of the most mockable economists in American history is (Nobelist -the Swedes have dry humor) Paul Samuelson.  One could write entire books on the ways in which Samuelson was a scoundrel and a numskull who set back human knowledge by decades. One fact will suffice for this essay: Samuelson didn’t believe in Kelly betting. Explaining why he thought this, and why he’s wrong would be pointless; debugging an economist’s faulty thought processes is as pointless as explaining why a crazy lady is breaking dishes in the kitchen. If you’re interested, Ed Thorp is your man here also.


Ed Thorp is the man, period

Following Ed Thorp’s original essay in the Gambling Times, as good little experimental physicists, we need to build up an error budget to figure out our edge.  Thorp breaks down the errors in his and Shannon’s Roulette system into several kinds.

  1. E1 Rotor speed measurement error
  2. E2 Ball speed measurement error
  3. E3 Ball rotor path randomness
  4. E4 Ball stator path randomness
  5. E5 Fret scatter
  6. E6 Rotor tilt (discovered by Shannon and Thorp)

Uncorrelated errors add up as the sum of squares, so the total error budget is

Error = \sqrt{\sum_{n=1}^{n=6}{E_n^2} }

The Thorp/Shannon roulette system had a 44% edge on the most favored number; single number payouts in Vegas are 35:1, making the correct bet on one number 0.44/ 35 = 0.01256. Since nobody in 1960s Vegas suspected the mathematical machinators of having a physics edge on the wheel, they were able to place larger bets on parts of the quadrant. While Thorp describes it as “diversification” in his exposition. Another way of thinking about it: he’s just playing more games at once. A friend and former customer explained his trend following method as working in much the same way. The more bets you place, the more likely you’ll hit a winning trend.

Kelly betting isn’t a perfect solution in all cases; fixed fraction betting has certain disadvantages when you can’t exactly characterize your edge, or the payout odds, or you have a limited number of bets before you have to cash in your chips. However, in the case of a machine to beat Roulette, it’s difficult to think of a better technique.

Of course, Kelly betting and things like it figure in other sorts of betting; people do use it in Markets where it is appropriate. Supposedly it was part of Axcom/Rentech’s early secret sauce, and certainly folks who have thought about trading need a bet sizing and risk management strategy that makes sense. Kelly is often a good place to start, depending on your situation. But that’s a topic for another blog post. One more coming on modern techniques to beat Roulette, including the one I came up with in 2010 (which, in case you were holding your breath, didn’t really work, which is why I have to work, and am willing to talk about such things in blogs).

Kelly criterion resources

Kelly’s original paper:


Thorp’s explanation:


Thorp’s website:




On beating roulette: part 2

Posted in Gambling systems by Scott Locklin on May 30, 2011

The second team I know of were physics students at the University of Santa Cruz in the late 1970s. I read about this before I went to college; the book is called Eudaemonic Pie. This group used the same technique, but instead of an analog computer, they used an early 6502 based microcontroller. There are many advantages of microcontrollers over analog circuitry. For one thing, it’s theoretically easier to change or calibrate the algorithm. For another, you can make more complex interfaces and change them dynamically. They also tend to break less often: a bug free algorithm will run more or less forever on an integrated circuit, wheras there are all kinds of bad things which can happen over time to hand soldered analog circuitry. Their project had a lot of problems, however.

Their biggest obvious problem: microcontrollers were new technology in those days. Things like emulators, assemblers, compilers and debuggers: things we take for granted today, these were nonexistent. Imagine trying to program your PC using flip switches … and having no output but a couple of voltage levels. That’s hard stuff. They also had too many people working on the project who didn’t materially contribute to the outcome; artists are fun people to have around, but they’re also distracting, and don’t really help you to get stuff done. Finally, there was an obvious lack of focus on solving the problem: this is a pathological engineering cycle I’ve been involved with myself. It’s easy to get distracted by things like computers. Really, the computer isn’t important: the solution is the important thing. As such, it took their team many years to reach the point where Shannon and Thorp got with 12 transistors and 5 months worth of work. In the end, the same problem which bedeviled Thorp and Shannon ended up sinking this project before they made significant profits. Home made electronics don’t work well when encapsulated into shoes and such. Many of the same team moved on to become important Scientists at the Santa Fe institute and followed Thorp’s lead in becoming Financial engineering gurus. The Santa Fe group ended up being an important influence on my personal researches, and so, even though I am a bit critical of the book that chronicled their roulette adventures, I’ll always think highly of these folks.

There are other teams who did this with varying degrees of success over the years. In fact, this sort of technology is well established enough you can buy things which do this on the internets. Don’t ask me which ones are legitimate and which ones are bunk: it’s simple enough, such computers can certainly be purchased or built without too much trouble. Supposedly UNLV professor Harry Fechter developed a device in the late 70s, though he never tried to deploy it. There was an interesting patent filed in 1982 which appears to be more along the lines of an analog computer, but same basic concept as Thorp’s idea. Professional gambler Billy Walters used an as yet undisclosed technique to pull from the wheels in the early 80s. It was probably the same technique. I found this group on the internets. They used a similar approach to that of the Eudaemons, though they appear to have been more serious people (they also did a blackjack computer), and they had rather more advanced technology available to them. The PC-2 they used, for example, was excellent, and programmable in a high level language. Others have done more or less the same thing over the years. Sleight of hand expert Steve Forte claims that he can do the whole thing visually under certain circumstances. Frankly, the effort required even with the shoe computers seems close to superhuman to me, so I didn’t even consider trying to become a mentat.

The most recent team I know of one who was very successful in (allegedly; the reports are mixed) using a laser range finder in a cellular telephone. They made a over a million pounds in London. While they were arrested, there are (or were at the time) no laws in Britain against forecasting roulette, so the judge ruled the casino had to pay up, and the team was released. You can download a short video about them here. These guys were my inspiration for giving this sort of thing a bit of thought. Where they went right: obviously their system worked extremely well. One of the reasons I think it worked so well is it probably didn’t rely on humans to take the data. If indeed they used a laser range finder, this is probably a good reason for their success. They may also have simply divided up the measurement tasks to optimize efficiency, which is another approach. If one person practiced a lot with measuring ball trajectory, and another got good at measuring rotor speed, with the third specializing in making the bets, I’m sure some efficiency could be gained in this way. One of the daunting things to me about the original Thorp/Shannon system was the idea of doing everything at once. It seems too much work for one person to manage. I’m pretty sure if they used a laser range finder, the IR might show up on a security camera. That’s a good way to get caught. Another good way to get caught (as far as I can tell; the way they actually got caught): winning lots of money on one table.

Legal issues: beating roulette using a computer is completely illegal in the United States, or at least in Nevada, where most of the roulette wheels are. This is apparently the result of a team finding using some variant of a timing system in the early 1980s, though it is unclear what team was responsible for this. This fact is not true in other countries, as we learned from the story of the folks who took the Ritz for over a million pounds. In addition to the fact that the house edge in the US is double what it is in the rest of the civilized world, I had figured on attempting this in other countries. The ideal situation is one in which the casino never notices that you are winning too much money. A hand waving back of the envelope calculation gives a number in the low tens of thousands as an fairly undetectable take.  Obviously the casino will notice when you walk away with $40k, but they won’t notice it as much as $100k or a million take; it’s something that happens often enough it shouldn’t raise too many red flags. This isn’t a wonderful amount of money like the Ritz team brought home, but it is a sustainable amount of money, and there are plenty of casinos, and one could envision doing some pleasant travel over the course of a year. Beats consulting. Doesn’t beat trading, of course, which is one of the reasons I’m talking about this instead of making it work.

On beating roulette: part 1

Posted in Gambling systems by Scott Locklin on May 26, 2011

Beating roulette seems like a fool’s errand, much like beating the markets. After all, the roulette wheel is a physically random system isn’t it?

Being a great fool myself, I’ve thought about this rather a lot. I thought about it to the point where I thought I had a novel way to beat the roulette wheel, and invested a bit of effort and treasure into seeing if I could make it practical. As it turned out, my idea wasn’t so good. In the interests of inspiring some other fools out there, and because this was a fun project to think about for a while, I’m going to talk about some of the issues involved in designing a way to beat roulette. I have no intentions of following up on this project with another one, though I can think of two offhand which would do very well at beating roulette, if you have the engineering resources to dump into it. I probably won’t tell you about these, but anyone who reads this series ought to be able to figure them out on their own.

The way I see it, there are easier ways to make money: ones which don’t involve any risk of having your teeth kicked in by casino thugs, and which don’t involve substantial R&D costs. My idea was simple enough it had a chance of working in a period of time which would have been worth my efforts, which are otherwise better spent on other fool’s errands, like beating markets and chasing pretty girls.

History time: most say the roulette wheel was invented by Blaise Pascal in 1655 while he was attempting to create a perpetual motion machine. Ironic, as I was sort of looking at it as a perpetual money machine. Really though, Pascal invented the rotor part of the roulette wheel; the part which spins around at a deterministic speed. This isn’t the interesting random part of the device. Randomness is introduced by the scattering bumps and the pockets inside the rotor. Roulette was first played in its present form in the late 1700s in France. There are 36 numbers on the rotor of a roulette wheel, along with one or two zero pockets, which provide the house advantage. For the purposes of this discussion, the only important strategy is betting on a number. The payout on a number bet is 35:1, which makes it an exciting game. The house advantage on a single 0 wheel is 2.7%. For double zero wheels, 5.26%. This is a fairly small advantage to beat, so a forecasting algorithm doesn’t have to do very well to give you a reasonable probability of a profitable game.

There have been quite a few dumb ideas floated for beating roulette. The dumbest are pure bet sizing systems. If you go look at the literature, or just “gambling times,” there are a number of examples of people who thought they had a bet sizing system which would have allowed them to win. The problem, of course, is the house edge. Bet sizing systems are important, but they’re only important when you have an edge. Quite a few smart people thought they could use martingale betting to do this.
Another less dumb idea was looking for a dealers signature: the idea being that the croupier who sets the ball to spinning could bias the outcome. This makes a little more sense, but has an obvious downside: you need a roulette croupier confederate to make any money at it. As it turns out, it is not possible for the dealer to bias the outcome in any case.*

The simplest form of attack on Roulette which works is finding biased wheels. While roulette wheels are not supposed to have any bias, they often do, generally because they’re tilted, and so one of the quadrants is more likely than others. The bias could also be due to defects in the rotor or rotor pockets: modern wheels have very careful engineering to prevent this kind of bias: the pockets, for example, are generally machined from a solid piece of metal, so they can’t be dented or bent: a feature added by Huxley in the early 1980s. Several teams have managed to find biased wheels by keeping careful track of the outcomes; according to Wikipedia, the first was British engineer, Joseph Jagger in 1873. The problem with this sort of approach is, obviously, casinos don’t like it, and it’s something they have control over. An obvious countermeasure is to move the wheels around every few days; something they did to Jagger way back when. Since the wheels are physically indistinguishable, whatever statistics you gather on an individual wheel will be irrelevant in a few days. These days, wheels are actually networked, such that bias can be detected by the casino itself, and the wheel can be serviced when it begins to show the slightest bias. They also use wheels which are constructed in a way (shallow pockets, basically) which makes this sort of bias much less likely, even with strongly tilted wheels.

The first men to beat roulette using an actual forecasting algorithm were Ed Thorp and Claude Shannon in 1960. Ed Thorp was the guy who wrote beat the dealer and invented card counting in Blackjack. Claude Shannon was, well, he was freaking Claude Shannon: shoot yourself now if you don’t know who he was. How did the algorithm work? Key to their attack is the fact that you can place a bet well after the ball is in motion. Thorp and Shannon purchased a cheap wheel and did experiments (I did too; same wheel is still manufactured and available on ebay for a couple of bucks). You can see some of their early experiments on Thorp’s website, and read about it in a series of papers Thorp wrote for the Gambling Times, all linked below. To summarize: they found that one could predict the quadrant the ball would fall into with a large enough probability to make betting profitable by measuring the speed of the rotor (which is effectively constant for a given game: remember, it started out as Pascal’s perpetual motion machine), and the speed and decay rate of the orbiting ball. Essentially, they curve fit a spiral orbit of the ball around the track, and matched it against the orbit of the rotor. There is still plenty of randomness in the roulette wheel: even with a perfect measurement, the ball scatters off of the various randomizing bumpers and bounces around in the rotor pockets, but you could get enough of an edge that, with a careful betting system, you could consistently make money at it.

The velocity measurements were taken using microswitches built into a shoe, and the curve fitting done via analog computing. The engineering was fairly complex, involving various microswitches, analog computers, buzzers (which returned the quadrant) and radio transmitters (the electronics was not small enough to fit into one shoe). It also involved a fair amount of hand eye coordination; if you couldn’t accurately measure the velocity of the ball or the rotor, your forecast would be worthless. The ultimate required accuracy was about 10 milliseconds (or one ball diameter). This is within the bounds of human ability, though it requires concentration and practice, making it a two person project in general: one to take measurements, and one to place the bets. Ultimately, the Thorp-Shannon team (their wives were also involved) found that this wasn’t practical using the electronics they were using, which were unreliable and tended to do unpleasant things like shock the user, and so they moved on to other projects.


Ed Thorp wrote a fascinating series on this subject for the Gambling Times. He’s generously made it available on his website here:
Paper 1
Paper 2
Paper 3
Paper 4

A paper on the analog computer they used to accomplish this feat (scanned jpg files unfortunately):
Page 1
Page 2
Page 3
Page 4
Page 5
Page 6

*Thorp papers on the croupier’s signature:
signature 1
signature 2

Thorp’s papers on the fallacy of roulette betting systems:
betting systems 1
betting systems 2
betting systems 3

Finally, the Shannon-Thorp team’s early experiments are documented and shown below:
the video of his early experiments
The documentation

The Thorp website is an amazing treasure of the mathematics of probabilistic systems, and anyone who cares about this sort of thing should read the whole damn thing. I did. Thorp himself appears to be made out of concentrated awesomeness, and has displaced Feynman as my intellectual hero: