When you are a hardware guy and you live in a time of crisis, sooner or later you find yourself working for some casino equipment company. You become an insider and learn a lot about their tricks. I’ve been in touch with that business for about 30 years. I made a lot of projects for gambling machines which are currently in use, and I had a lot of contact with casino people, both owners and gamblers.

Now I’m sure you expect of me to tell you about the tricks they use to make you spend your money. And I will: there are no technical tricks. This isn’t because they are honest people, but because they don’t need it. Mathematics and Psychology do all the work.

Does the risk of gambling pay off? Mathematically speaking, no – but it’s up to you to decide for yourself. One thing is for certain – whether you decide to gamble or not, it’s good to know how those casino machines work. Know thy enemy.

The Typical Gambler’s Financial Chart

Let’s see how the amount of gambler’s money fluctuates over the course of a typical slot machine game. Player starts with credit S and usually has small loses, but also small gains. Sometimes he wins a larger sum, but in the long run, it’s clear that he is moving towards zero. This is just an example of an average game and while it will not always look like this, most of the time it will. Even if he wins on a good day, you can simply scale the same diagram and apply it over a longer period of his life.

The gambling machine does not “draw” this diagram in advance, it does not even plan more than one step ahead. There is no “secret plan”, but only the simple arithmetic rule which determines the amount of gain, or, in some cases, the probability of winning. When you combine it with the randomization process, you get the diagram, and that’s all.

Formally speaking, the game is fair, and in accordance with the regulations. The odds are fair for both sides, although the casino has a small edge on its side, as it has expenses to cover.

If the game is truly fair, then why are there so many rich casino owners, and even more poor gamblers? There is no special reason, we all know that a small portion of input goes to the casino, and we agreed that it’s fair, but that’s where the mathematics and psychology kick in. First, that “small” amount of money is taken from the player every time he presses the button, or runs the new cycle, whichever game he plays. That cycle can run for just a few seconds, so the cumulative effect can be significant. If you are the game development engineer, keep in mind that if the game is faster, the casino owners will love it more. Guess why?

This diagram illustrates why the game has to be fast. Let’s assume that, after the first hypothetical game, the losing/gaining chances are similar to Gaussian distribution. The greatest odds are in the center of Gaussian bell curve, but there are also the small chances for a big gain or a big loss, especially if the player has a risky style. It’s important to note that the diagram is not balanced, as the chances of losing are slightly higher.

The left hand diagram is valid only for the first game, after which the player presses the button again. After five games, the cumulative effect becomes visible, and after 30 games everything is clear. Even after that, the game goes on until the system collapses, which usually means that there’s no money left on the player’s side. He knows how this works, yet he continues playing till the end. Is it still fair? I have my doubts.

A long time ago, I was asked to make a modification for an old poker video game. After each succesful round, a player could perform an action where he had a chance of 50-50 to double or lose his last winnings. He had to push one of two buttons, guessing if the card (with the back side visible) was smaller or greater than 7. I had to reverse engineer the firmware for an 8-bit 6502 microprocessor, so I had to disassemble the code and see how it works. I was truly surprised to see that at that moment the card number still does not exist – instead, there is a decision, made by the system, whether the player will win or lose! When the player presses the button, the card number is randomly generated (inside the range of the desired result) and its bitmap gets written into the video memory.

I witnessed a lot of players who, when they would lose, shouted “Damn, why didn’t I press…”. How could I tell them that the outcome would have been the same?

Psychology of Gambling

Everyone who has spent some time in a casino, knows that every gambling machine reacts very theatrically to winning, with loud music and jingling sounds, and every loss is quiet and promply followed by an invitation for the next game. Great winnings are remembered and frequently mentioned for a long time, and the losses are forgotten. That’s how the illusion that gambling pays off is created. This feature is called selective exposition, and it plays an important role, not only in gambling addiction, but also in the belief in the supernatural, psychic ability, astrology, quackery and so on.

Look again at the first chart. There are a lot of good winnings, which are marked with smileys. Each of them brought pleasure and hope to the player, and only the last one brought him dissatisfaction. The gains are great and come by surprise, and losings are small and gradual – you could say they are hardly noticeable. Does it pay off, to feel a lot of happiness and only a little bit of discomfort? It’s up to the gambler to decide, but the delusion obviously works, as he never sees himself as a loser, even when he had lost everything. He knows that, as soon as he gets more money, he will come again and it will, undoubtedly, be his lucky day.

Looking at the first chart, it’s hard to resist the feeling that he should have ended the game at the moment his credit was twice of what he had at the start. Looking back, it would be clear to the player as well, but it was the heat of the moment – he got his dose of serotonin (hormone of happiness), and it’s not a good thing to be high on when you have to make a smart decision. It has led to the narrowing of his consciousness, he experienced it as his “lucky moment”, which is a trap for every gambler. Did you ever wonder why there is no daylight and no clock in the casino? The time has stopped in the whole world and all you have to do is to gamble.

Very few players can tell when it’s wise to quit gambling. It is really hard to stop when it has just started going well, and when the new gain is just around the corner. There is only one situation when the player gets the idea to stop playing, other than running out of money: when he gets the super jackpot. Then it’s time to enjoy, not to play. He takes his money and leaves, but there is always tomorrow, when he comes to take more. Of course, with a larger bet, as he is a high stakes player now. He won’t settle until he gives back everything he had won.

Recently I was installing some equipment in a nice casino in southern Macedonia which sees a lot of Greek visitors. Everyone got excited when a Greek woman won a 24.000 € jackpot. My first thought was that, if she is clever enough, she will leave and never step into the casino ever again. When I was there again after two weeks, the staff from the casino told me that she had already “returned” about half of the sum. Another two weeks passed, and her count was way below zero.

I’m Not Superstitious, It Brings Bad Luck

Most, if not all, gamblers are superstitious. They have their lucky day, lucky garment, lucky number, whatever – there’s always an obvious reason for winning or losing. So, the good winning from the first chart was because of a player’s lucky t-shirt (it was blue, his lucky colour), but everything went wrong when he crossed his legs unintentionally. Also, he must not forget to do his lucky ritual tomorrow before entering the casino.

Being superstitious usually means being bad at mathematics and logic, and especially at critical thinking. After all, if passionate gamblers knew how to think critically, they would probably never step into the world of gambling.

As the illiterates in the theory of probability, gamblers are frequent victims of the logical paradox known as the “Gamblers Fallacy”, expecting that a series of the same results will correspond with the opposite outcome. For example, if a roulette wheel lands on black for a number of times in a row, they expect it to land on red. It’s also amusing how the players of bingo and lottery games often draw the opposite conclusion – if a certain number had been drawn more frequently than others, that means it is predestined to be drawn, and it should be used even more.

These two “schools of thought” mutually exclude each other and, of course, both of them are wrong. If the roulette wheel lands on red 10 times, the next turn has the exact same odds of landing on red or black. As the mathematicans say, dice has no memory.

Many gamblers that try to hack the lottery, casino or online games, create numerous betting systems. Unfortunately for them, mathematic algorithms in most games are very simple, which makes it hard to find any weak point which could be exploited for a gambling strategy.

When a gambler scores a large win, which is just a step short of the “superbingo”, that step appears to be much smaller than it really is. For instance, if he plays the 7/39 Lotto (translated) and has 6 numbers matched, he feels he was very close to the ultimate prize, but in fact he was pretty far. There are 224 possible 6’s and only one 7, which is 99.6% versus 0.4%. Doesn’t look so “very close” anymore!

The human brain is good at making snap estimations in a lot of real life situations, but when it’s about the probability theory and large numbers, it easily gets fooled. If you combine it with selective exposition, it can lead to very bad evaluation and then to bad decisions. Someone who organizes gambling events of any kind, knows this and he tries to spread the story about winners, and never mentions thousands, or even millions of people who got nothing for their money.

Can You Hack the Casino?

But, never say never! The well known exception to everything that was said here, is the blackjack game. Players can use tactics to gain a certain edge in the game, but it assumes using either illegal devices, or special mental techniques, which include intensive memorization and computation, with a risk of being permanently blacklisted. Some players are also hunting for bugs in online games, but it is more likely that they will lose a lot of money experimenting, rather than finding a viable weak point.

Do you think you can hack the casino, even an online one? To accomplish this, be prepared to outsmart a team of well paid professionals, who spent a lot of time and resources to make sure you don’t. You probably won’t score with one simple project, but if you have a solid knowledge background and spend a lot of time studying the problem, you might stand a chance.

The most vulnerable gambling machines are those with mechanical randomizers and automated reading. Optical readers (bar-code or cameras with OCR software) may be fooled by excess light (modified laser pointer or similar device), and RFID readers with 125 KHz or 13,56 MHz jammers. Anyone who knows how to use it, can sabotage the machine with the device, if he does not like the ball or dice which was just drawn. I have seen a lot of casinos that are not equipped with sensors which could prevent this kind of attack. Anyhow, it is too dangerous to use this idea in its raw form, so an attacker would need to carefully consider his approach, and of course, keep an eye out for surveillance cameras.

Albert Einstein once said: “No one can possibly win at roulette unless he steals money from the table while the croupier isn’t looking.” He was probably the greatest hacker of all times, but everybody has the right to be wrong.

[Illustration by Bob Zivkovic]

​​ Voja Antonic works as a freelance microcontroller engineer in Belgrade. His first microprocessor projects, based on Z80, date back to 1977, just a few years after the appearance of the first Intel’s 4004. He assembled the firmware manually, by pen and paper. In 1983, he published his original DIY microcomputer project called Galaksija, which was built by around 8000 enthusiasts in the former Yugoslavia. To date he has published more than 50 projects, mostly based on microcontrollers, and released all of them in the public domain.