In his new book,The Perfect Bet: How Science and Math Are Taking the Luck Out of Gambling, Adam Kucharski details how trying to understand dice games led one mathematician to develop probability theory, how one of the first wearable computers was designed to covertly predict the fall of a roulette ball, and how poker-playing bots are advancing more quickly than we think. As he shows, science, mathematics, and gambling have long been intertwined, and thanks to advances in big data and machine learning, our sense of what’s predictable is growing, crowding out the spaces formerly ruled by chance. At the same time, though, we’re letting more of our lives be influenced by algorithms, bits of code whose effects are beyond our full understanding. As in so many other areas, the creations are outpacing their creators. In the lightly edited interview below, Kucharski explains how we got here, what poker-playing bots can show us about being human, and what comes next.

In the book you call gamblers the godfathers of probability theory, noting that it’s a newer area of mathematics than we might expect. Can you talk a little bit about how probability theory came out of gambling?

One thing that I found remarkable about the history of math is that it’s only fairly recently that people looked into quantifying luck, so really for a long period of history, topics like geometry were the main study. There was a lot less interest in random events: it’s actually not until the 16th century that gamblers start to think of how likely things are and how that could be measured.

There was a gambler called Gerolamo Cardano: although a physician by profession, he had a pretty keen gambling habit. He was one of the first people to outline what’s known as the sample space. This is all of the possible outcomes you could get, say, if you’re rolling two dice together, there’s 36 ways they can land. And then of these 36 ways you can home in on the ones you’re interested in. This provided a framework for measuring these kinds of chance events.

That was of the first foundations of probability theory. From that point over the subsequent years, a number of other researchers built on those ideas, again often using bets and wagers to inspire the way they thought about these problems.

You recount several examples of scientists taking on certain gambling problems. Richard Feynman, for example, tells professional gambler Nick the Greek that it seems impossible for a gambler to have any advantage.

Feynman was obviously famous for his curiosity. On his trips to Vegas, he wasn’t a big gambler, but he was interested in working out the odds. I think he started with craps, figuring that although it was pretty poor odds, he wouldn’t lose that much, and it might be a fun game. On his first roll he lost a load of money, so he decided to give up.

He was talking to one of the showgirls, who mentioned Nick the Greek. He was this famous professional gambler, and Feynman just couldn’t work how you could have the concept of a professional gambler because all the games are stacked against you in Vegas. On talking to him he realized what was actually happening was Nick the Greek wasn’t betting on the tables. He was making side bets with people around the table. He was almost playing off human flaws and human superstitions, because Nick the Greek had a very good understanding of the true odds.

If he made side bets at different odds he could kind of exploit that difference between the true outcome and what people perceive it to be. That’s a theme that continues throughout gambling: If you can get better information about what’s going to happen and you’re competing with people who don’t have much idea about how things are going to land or what the future might be, then that gives you a potentially quite lucrative edge.

There’s a sense that being at the whim of chance is somehow a very human position. Admitting things as totally unpredictable and leaving yourself up to fate is often part of the allure for the nonprofessional gambler. But then there’s a tension, because other people say maybe these are things that we can predict, and maybe this isn’t as much up to chance as we imagine it to be.

It’s really been this almost tug of war between believing something is skill and believing something is luck, whether it’s in gambling or just in other industries. I think we have a tendency if we succeed at something to think it’s skill and if we fail at something to almost blame luck. We just say, “Wow, that’s chance, there is nothing I can do about it.”

The work of a lot of people who study these games is trying to think of a framework within which we can measure where we are in terms of skill and in terms of chance. Mathematician Henri PoincarĂ© was one of the early people, in the early 1900s, interested in predictability. He said that when we have uncertain events, essentially it’s a question of ignorance.

He said that there are three levels of ignorance. Depending on how much information you have about the situation and what you could measure, things will appear increasingly random. Not necessarily because it’s truly a lucky event, but really it’s our perception that makes it appear unexpected.

One of the games that I think we expect to be least predictable is roulette. But as you point out, Claude Shannon, considered the father of information science, and Edward Thorp, who would later write one of the most popular books on card counting, made a strong case for being able to predict roulette spins.

For a long period of time, roulette has almost been like a case study for people interested in random events. Early statistics was honed by studying roulette tables because you had this process that was seen as very complicated to actually understand fully, but if you collected enough data then you could analyze it and try and look for patterns and see whether these tables are truly random.

Edward Thorp, when he was a Ph.D. physics student, realized that actually beating a roulette table, especially if it’s perfectly maintained, isn’t really a question of statistics. It’s a physics problem. He compared the ball circulating a roulette table to a planet in orbit. In theory, if you’ve got the equations—which you do because it’s a physics system—then by collecting enough data you should be able to essentially solve those equations of motion and work out where the ball is going to land.

Although in theory that could work, the difficulty is [that] in a casino, you actually need to take those measurements and perform those calculations to solve those equations of motion while you are there. So Thorpe then talks to Shannon, who was one of the pioneers of information theory and had all sorts of interesting contraptions and inventions in his basement. Thorpe and Shannon actually put together the world’s first wearable computer. The first wearable bit of tech was designed to be hidden under clothing so you could go into casinos and predict where the roulette ball will land.The first wearable bit of tech was designed to be hidden under clothing so you could go into casinos and predict where the roulette ball will land.

Those early attempts were mainly let down by the technology. They had a method which potentially could be quite successful. But it was implementing it, for them at that time—that was the big challenge.

You mention, though, a much more successful attempt in 2004.

This is the Ritz casino in London, where you have these newspaper reports of people who were initially said to have used a laser scanner to try and track the motion of the roulette ball. In the end, they walked away with just over a million pounds.

That’s an incredibly lucrative take, even for high-stakes casinos like that. This [attempt] reignited a lot of the interest in these stories because, although Thorp and subsequently some students at the University of California had focused on roulette tables, they’d always left out a bit of their methods.

They’d never published all the equations....MUCH MORE