Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Classic Games (Games) Math

How a Mathematician-Magician Revealed a Casino Loophole (bbc.com) 102

It's the tale of a company manufacuring precision card-shuffling machines for casinos — and a gang of hustlers who used a hidden video camera to film the shuffler's insides. "The images, transmitted to an accomplice outside in the casino parking lot, were played back in slow motion to figure out the sequence of cards in the deck," remembers the BBC, "which was then communicated back to the gamblers inside. The casino lost millions of dollars before the gang were finally caught."

So the company turned for help to a mathematician/magician: The executives were determined not to be hacked again. They had developed a prototype of a sophisticated new shuffling machine, this time enclosed in an opaque box. Their engineers assured them that the machine would sufficiently randomise a deck of cards with one pass through the device, reducing the time between hands while also beating card-counters and crooked dealers. But they needed to be sure that their machine properly shuffled the deck. They needed Persi Diaconis.

Diaconis, a magician-turned-mathematician at Stanford University, is regarded as the world's foremost expert on the mathematics of card shuffling. Throughout the surprisingly large scholarly literature on the topic, his name keeps popping up like the ace of spades in a magician's sleight-of-hand trick. So, when the company executives contacted him and offered to let him see the inner workings of their machine — a literal "black box" — he couldn't believe his luck. With his collaborator Susan Holmes, a statistician at Stanford, Diaconis travelled to the company's Las Vegas showroom to examine a prototype of their new machine.

The pair soon discovered a flaw. Although the mechanical shuffling action appeared random, the mathematicians noticed that the resulting deck still had rising and falling sequences, which meant that they could make predictions about the card order. To prove this to the company executives, Diaconis and Holmes devised a simple technique for guessing which card would be turned over next. If the first card flipped was the five of hearts, say, they guessed that the next card was the six of hearts, on the assumption that the sequence was rising. If the next card was actually lower — a four of hearts, for instance — this meant they were in a falling sequence, and their next guess was the three of hearts. With this simple strategy, the mathematicians were able to correctly guess nine or 10 cards per deck — one-fifth of the total — enough to double or triple the advantage of a competent card-counter....

The executives were horrified. "We are not pleased with your conclusions," they wrote to Diaconis, "but we believe them and that's what we hired you for." The company quietly shelved the prototype and switched to a different machine.

The article also explains why seven shuffles "is just as close to random as can be" — rendering further shuffling largely ineffective.
This discussion has been archived. No new comments can be posted.

How a Mathematician-Magician Revealed a Casino Loophole

Comments Filter:
  • Bad title (Score:5, Insightful)

    by RightwingNutjob ( 1302813 ) on Sunday October 23, 2022 @03:51PM (#62991501)

    Not a loophole. Cryptographic flaw.

    • How did they discover the wifi buttplug? Didn't someone beat Magnus Carlsen at chess with one of those?

      • How did they discover the wifi buttplug? Didn't someone beat Magnus Carlsen at chess with one of those?

        You know what's harder than beating Magnus Carlsen at chess? Talking about a rectally-enhanced chess win, with a straight face.

        I heard even the porn director couldn't stop laughing long enough to make a parody of this.

        • You know what's harder than beating Magnus Carlsen at chess?

          Convincing Magnus that he actually lost?

          • The chess hack is absolutely a cheat, but this card shuffling thing just tips the odds back in the players favor. They chose to shuffle the cars that way, and if they shuffled them in slow motion in front of the player they would be equally at fault. Tipping the odds in your favor, as long as it is not by looking, should not be against the law, and the gambling commission should force payouts, even if the players count cards. That is only fair. It is not gambling if the casino gets the upper hand by math an
        • by Opyros ( 1153335 )
          Ars had an article [arstechnica.com] about someone who tried to actually construct such a device.
    • by sabri ( 584428 )

      Not a loophole. Cryptographic flaw.

      Not News For Nerds. A clickbait advertisement leading you to a paywalled article.

      Fuck paywalls, and fuck you, /. for disguising ads as news content.

  • make the shuffling not know what card is in there and just number the cards buy number and when it's loaded you do an quick random wash.

    • make the shuffling not know what card is in there and just number the cards buy number and when it's loaded you do an quick random wash.

      The machine doesn't "know" in what order the cards are placed inside. It's only job is to shuffle the cards such that they are sufficiently mixed. Somehow, for whatever reason, it wasn't shuffling the cards enough to prevent card counters from guessing what the next drawn card might be.

      I'm surprised this is even an issue because last I heard casinos were using perpetual shuffling machines. Instead of shuffling the cards then letting them be drawn, the machine continues to shuffle the cards while they are

      • Remember, they didn't use the unit being tested here. The continuously shuffling machines may be what they ended up going to instead, because a single pass machine wasn't enough.

        Continuous operation sounds more expensive - more power, more wear on the mechanicals, etc...

        • by rgmoore ( 133276 )

          Wear and tear on the shuffling machine is just part of the cost of doing business. As the story shows, the really expensive thing is letting the cards be predictable. That's why casinos replace their cards frequently; it's cheap insurance against the cards having visible wear that would let players recognize them.

          • Well, of course. Like I said, "a single pass machine wasn't enough" - IE it doesn't introduce enough randomness, which could allow card-counter type people to beat the house odds. With traditional card counting(and single deck operation), it's a very slim advantage to the player. With multiple decks in the boot/shuffler, that mostly goes away. If they have a method that allows them to beat card counting odds by 4X, that's serious money, thus unacceptable.

            Which is why I mentioned that the machine never w

      • I remember seeing a news report or documentary or something about how some casino somewhere did no shuffling at all at the table. There was a centralized shuffling facility and cartridges of prerandomized cards were taken to tables.

        I may be imagining this, but I also remember reading something about casinos defeating card counters by not guaranteeing that a full deck was in each cartridge, only that the next draw from each cartridge was guaranteed to be random.

        I imagine tactics like that may be regulated, s

        • by _merlin ( 160982 )

          In Australian casinos, they have a shuffling machine at the table, and they usually have at least four decks of cards in it. They shuffle every hand. It makes card counting impractical.

        • How can the next card be random
          If there is a 0% chance of some cards being drawn? That makes at least one card being overweighted against random.

          • The probability that any card is going to be drawn next is 1/52 for all draws. This is not the case for a shuffled full deck (or any finite number of full decks) because the chance of the next card being one you've already seen is zero.

            • Uh, no.

              I was referring to the comment about a full deck not being included. Without a full deck, the probability of some cards being drawn is 0, since they are not in the deck, and the probability of other cards is greater than 1 in 52, since there are less than 52 cards in the deck.

              • by kenh ( 9056 )

                The issue is that they take 4 complete decks, shuffle them all together, so you wind up with a mega 208 card deck, which has 4x of every card.

                If you peel off the first, second, third, or fourth "proper" deck of 52 cards, you may have as many as 16x of a given card (for example 16 Aces - 4 Ace of Hearts, 4 Ace of Clubs , N4 of Ace of Spades, and 4 Ace of Diamonds).

                If dealing from such a deck, every player at a 4 hand table COULD have an identical hand - it is a mathematical possibility, but exceedingly unlik

        • I imagine tactics like that may be regulated, so what flies in Indian casinos may not fly in New Jersey may not fly in Vegas

          In Indian casinos a guy in a turban plays a pungi and the cards rise up out of the deck and shuffle themselves. Not sure what they do in Noo Joisy, possibly something involving bagels.

      • USA wise, las vegas and Louisiana, the continuous shuffling machine are not everywhere. If you see them for blackjack they are in the busier tables but go a few tables in and they are not in use.
        They are more there to stop the high/low counters but to combat that places are using more decks and shuffling more often.
      • It's casinos balancing their security vs what players want - and there are a lot regulars that avoid the continuous ones (granted, probably a good chunk that are trying to count - and a good chunk of those probably counting poorly anyway).

      • by kenh ( 9056 )

        Isn't this "flaw" predicated by feeding the shuffler a "straight" (new) deck where the cards go in the machine in sequential order? FFS just do a quick shuffle before you feed it into the machine!

        I fail to understand/the article fails to explain how you get "rising" and "falling" runs of cards from a random deck of cards unless the machine can identify each card and intentionally puts them in a certain order.

        • by poptix ( 78287 )

          They're put in the machine in order to make it easier to show the casino staff the problem.

          In any ordinary card game you're going to see the order in which cards were folded and dropped into the shuffler (depending on the game), so the 'seed' is known.

          The goal is to build a shuffler that can actually provide a random shuffle, even with knowledge of the 'seed'.

    • Print the cards on demand using an RNG.
      • by GoTeam ( 5042081 )

        Print the cards on demand using an RNG.

        Hopefully they won't use IBM's RANDU...

      • by kenh ( 9056 )

        The intent of this exercise is to speed up the game, and printing each card on demand is not only slower, it is incredibly wasteful.

        You are trying to turn a card game into a video game, albeit with printed artifacts.

    • by fermion ( 181285 )
      This is an example of limited ability to truly solve a problem. Yes, print the cards. If you have to use colors, but really maxima; white space is best. Use a true random number generator to print, like the decay of atoms.
  • by sconeu ( 64226 ) on Sunday October 23, 2022 @04:08PM (#62991549) Homepage Journal

    "We are not pleased with your conclusions," they wrote to Diaconis, "but we believe them and that's what we hired you for."

    They didn't shoot the messenger because they were unhappy with the results. They accepted them and acted upon them. That's what you want to see.

    • If only Twitter had the same response to Mudge.
      • > If only Twitter had the same response to Mudge.

        Mudge did a tour of duty at DHS. People say he was supposed to understand why a limited set of addresses had access to exploits in unpatched software. Apparently he didn't get it and was asked to leave. We won't really ever know if the company isn't sold.

    • > That's what you want to see.

      Tens of millions of dollars can often help find clarity.

      In private corporations, at least.

  • With a 52 card deck, 7 perfect shuffles returns you to your starting point. It is not random. Try it. You need to be consistent. Start with your deck stacked by suit and order so you can verify easily after the process. You need to split the deck into two stacks of 26 the same way every time. Say top 26 to right hand pile, and the bottom 26 to left hand pile. The easiest way is to count off the top 26 into a new pile, flipping them one at a time. And then turn that pile over. You need to decide w
    • Re: (Score:3, Informative)

      by Anonymous Coward

      You're describing "interleaving", which is the exact opposite of a perfect shuffle.
      A perfect shuffle is when a random number of cards from one side is followed by a random number of cards from the other side, and repeated.

      Every other card is the most imperfect shuffle possible, and no one uses that term to describe it.
      It is akin to intentionally and meticulously looking at and placing a coin on a table facing up, then describing that action as "flipping a coin"

      • Re:seven shuffles (Score:5, Insightful)

        by retchdog ( 1319261 ) on Sunday October 23, 2022 @05:31PM (#62991755) Journal

        This comment template is depressingly common on slashdot.

        "{Whatever is being reported on} is wrong! If you think about {my own subjective misinterpretation of the reported words into something trivial I'm familiar with}, you'll quickly see that I'm right and this {very well-qualified expert} is wrong! Now I will {explain trivial details of my own misunderstanding to you, as though you're just as stupid as I am}!

        • Your rant might be correct, and might even fit this comment. But the Anonymous Coward is correct. Carefully adjusting the sequence of cards is not perfect shuffle.

          Line up seven coins on the table. Flip all the odd coins in round 1. Flip all the even coins in round 2. Repeat, repeat. You will get original sequence. It ain't no perfect coin flip.

          Get it?

        • Slashdot: Uh, this a a nuclear meltdown.

          Expert: [laughs] Oh, meltdown. Itâ(TM)s one of those annoying buzzwords. We prefer to call it an unrequested fission surplus.

          You: Well, sir, your point about nuclear hysteria is well taken. This commenter promises to be more trusting and less vigilant in the future.

      • And you have made my point.

        Your definition of perfect is not what I was describing.

        The article also explains why seven shuffles "is just as close to random as can be" -- rendering further shuffling largely ineffective.

        Is not accurate.

        I was just noting that there is hidden order. Note that I never mentioned cutting the deck.

      • by jvkjvk ( 102057 )

        IN magic, this is also called a perfect shuffle, because it perfectly restores the cards to their original positions.

        Now, you have learned something!

      • by magnusk ( 569300 )

        You're wrong. "Perfect shuffle" is a term of art in mathematics, computer architecture, magic, and card shuffling, and means a perfect interleaving. At least do a Google search before going off on your ignorant rant.

        Perfect Shuffle: https://en.wikipedia.org/wiki/... [wikipedia.org]

    • Re:seven shuffles (Score:5, Informative)

      by zuckie13 ( 1334005 ) on Sunday October 23, 2022 @05:50PM (#62991817)

      Realize that when manually shuffling they dont' start with a sorted deck.
      Basic dealer process:
      1) Slide open deck to show all the cards (if a new deck)
      2) "Wash" the cards - scramble them face down on the felt - trying to make sure each card touches felt at some point. This is what really randomizes the cards.
      3) Stack the cards face down
      4) Riffle Riffle Box Riffle (Riffle means interleave them, Box means cut the deck basically in four or so parts and randomize that order). People thing this is THE shuffle - but the Wash does much more of the work. This just make it hard to follow a card if you tried to do that during the wash.
      5) Cut the deck

      In a machine - it's not just doing a 1:1 interleave to inject randomness - the basic home type probably takes a random number from each side as it goes - and you can/should do multiple passes. The casino types are picking cards at random to do that ordering (Well pseudorandom because - you know - software).

      • re: sorted deck

        I said that to make it easier for the reader to verify that there is indeed hidden order in 7 perfect shuffles. If you want to go thru the hassle, start with a what you believe is a random deck, and write down on paper each card in order, and then do the perfect shuffle as described above 7 times, and then compare the order to what you wrote down on paper.

        As to a card shuffling machine, I would make it do my description of perfect shuffle, but do random cuts. Applies to a human shu

    • One key point that lots of commenters here do not grasp is that, unless we are talking quantum mechanics, "randomness" is a very difficult to define term. When computers became a thing in the 1950s constructing a useful pseudo-random number generator became important (Monte Carlo simulation was the first big number crunching application)./p>

      Now everyone knows a PRNG is not really random (it has pseudo as its first two syllables) but for nearly all practical uses you do not need that and the RAND think

  • I met Percy Diaconis once - he is very nice. I was just new in the area of algebraic combinatorics, and he has some previous works that I was generalizing.
  • Remember, they are the biggest and most competent cheaters themselves. They even managed to make their crap legal. And they know that there are a lot of morons out there that do not understand that casinos are very good at statistics and detecting cheaters.

    • by bws111 ( 1216812 )

      Cheating is not playing by the established and known rules of the game. Casinos do not cheat.

      • by gweihir ( 88907 )

        Indeed. Casinos get the rules changed. But if you look reeeeally closely, I wrote that. May want to take some reading lessons....

        • by bws111 ( 1216812 )

          Maybe you should take writing lessons. What you wrote was "Remember, they are the biggest and most competent cheaters themselves." This is pure bullshit, and nothing you wrote after that changes that fact.

    • by bloodhawk ( 813939 ) on Sunday October 23, 2022 @06:48PM (#62991929)
      casinos don't cheat, they don't need to. The games they play mathematically favour them, that is all they need in the long run to win. Now that aside I am not suggesting casinos are good honest organisations, most are corrupt, play host to money laundering and crime. But that tends to be separate to the games themselves where they win simply by hosting them.
      • by gweihir ( 88907 )

        And then you read what I wrote and realize that I pretty much wrote that....

        • by Pascoea ( 968200 ) on Sunday October 23, 2022 @08:43PM (#62992173)
          Cheating, by definition, is not playing by the rules. Just because you write the rules you adhere to doesn't make you a cheater. If people are dumb enough to play a game that's inherently rigged against them, thinking they are going to come out ahead, that's a different conversation.

          realize that I pretty much wrote that.

          The world can only wish you were as smart as you think you are. Unless there is some mystery comment I'm missing here? Given that you've provided the same smug (and also wrong) reply to two comments in this same thread would lead me to believe otherwise. Or maybe, for those of us who just can't understand how brilliant you actually are, you could explain what you actually mean?

          • by gweihir ( 88907 )

            You overlooked that "cheating" has more than one definition.
            Here is some, obviously much needed help: https://www.thefreedictionary.... [thefreedictionary.com]

            • by bws111 ( 1216812 )

              And none of those definitions apply. There is no trickery or deception. There is no dishonesty. There is no 'not playing by the rules'. The rules are well established and public. The casinos play by those rules.

            • by Pascoea ( 968200 )
              I guess you still haven't got the rest of us caught up with you yet. How do any of those definitions apply to the conversation at hand?
        • no you didn't, you wrote they cheat, they are playing by the rules, cheating would be changing the odds of them winning in an underhanded/illegal way.
      • Casinos do cheat. Once on a craps table I was betting big... $300 a shot on long shots. After about a ten'ish fails, I won. Immediately they proceeded to tell me that there was a table maximum of $250 on the bet I was making (which turned out to be true) and returned $50 and paid off on the $250 max bet. But I protested that I wanted $50 back on each of the previous 10 bets too. They refused to do it claiming that they didn't know if I was betting above the max before and it was only discovered now. (This w
        • by bws111 ( 1216812 )

          They didn't cheat, you were just a moron. It's not the casinos job to fix your mistakes.

          • by Anonymous Coward

            Taking a bet over the limit is also their mistake.

      • by sursurrus ( 796632 ) on Sunday October 23, 2022 @09:22PM (#62992255)

        I'd add that casinos can and do bar successful players who don't cheat - aka legit card counters, under the justification that anyone who wins consistently in defiance of the bad odds 'must be' cheating.

        It's technically not 'cheating' in the sense of breaking a rule, because the casino has the right to bar anyone for any reason.

        However I'd like to point out that casinos obviously got that provision to fly with various gaming commissions through graft, bribery, and corruption. The ending of the movie _Casino_ especially made conclude that casinos are simply an economic drag and social ill. They demonstrate regulatory capture, the corruption you allude to, and have obvious roots in organized crime.

        The only reason Casinos are allowed to operate, in my opinion, is because the general public has an attitude of 'gamblers get what they deserve.' Casinos are essentially another form of social ill like fast food, quaintly allowed to operate on an elaborate framework of corruption and passing social costs on to taxpayers. 'Cheating' is too mild for what they do.

        • The only reason Casinos are allowed to operate, in my opinion, is because the general public has an attitude of 'gamblers get what they deserve.'

          No, they don't. You can discharge gambling debts through bankruptcy, but not student loan debts, so gamblers do not get what they deserve, and neither do people trying to make the world a better place through education. In general, the general public is fucking stupid. It doesn't even know what it believes.

          • Hey if it were up to me I'd line up the entire department of education and every single university dean and have a good old Roman style Decimation for treason where every 10th person is beaten to death by their colleagues. For casino owners I believe a slow death by exposure and starvation would be appropriate.

      • Casinos do not play host to money laundering. Most of them have *very* robust anti-laundering mechanisms which are quite expensive. There are a few regular posters here on slashdot (sorry I don't remember their handles) who have worked in anti money laundering for casinos and can describe just how extensive those measures are. Casinos make enough money selling their product that there is no financial incentive to play host to money laundering.

        Crime? If you mean the prostitutes who tend to work the c

    • by ceoyoyo ( 59147 )

      Sounds like somebody had a sure fire winning strategy. Roulette or blackjack?

  • Diaconis, a magician-turned-mathematician at Stanford University, is regarded as the world's foremost expert on the mathematics of card shuffling. Throughout the surprisingly large scholarly literature on the topic, his name keeps popping up like the ace of spades in a magician's sleight-of-hand trick.

    The literature hasn't been sufficiently shuffled. :-)

  • by ebcdic ( 39948 )
    Why would anyone want to help Casino owners?
    • by Pascoea ( 968200 )
      Because they'll pay you to do it? I don't like that people will help certain politicians get elected, but yet here we are.
  • "It's the tale of a company manufacuring precision card-shuffling machines for casinos — and a gang of hustlers who used a hidden video camera to film the shuffler's insides."

    This is something you'd expect to see in a movie plot. If only the Ocean's 12 & 13 writers had been this clever...

    • If you read the article, the camera was not actually in the shuffler.

      Rather, the shuffler had a glass side, so that players could see its inner workings, and see that it's not cheating. The hustlers hid the camera somewhere in the room pointed to the shuffler's window, and merely used it to "slow down the action" (shuffling would otherwise be too fast to follow the cards with your naked eyes).

      • If you read the article

        But that is a violation of Slashdot's Code of Conduct!

        Rather, the shuffler had a glass side, so that players could see its inner workings, and see that it's not cheating. The hustlers hid the camera somewhere in the room pointed to the shuffler's window ...

        That would not make for nearly as cool of a movie.

  • I keep meaning to learn more about it. What goes into making an algorithm, and why.

  • .... of dollars before the gang were finally caught ... Not doing anything illegal or against the rues of the Casio ... but were banned anyway

    • We all have instinct to cheer for the card counters (and I've made some extra pocket change that way). But casinos are a business. The odds of a blackjack game are about 98% meaning the casino get's a 2% margin for hosting the game. Imagine a retailer that bought hammers for $9.80 and sold them for $10. That would be nearly impossible to turn a profit. You can do it in Blackjack only because you get a lot of hands per hour. If you get one hundred hands per hour a $10 table will net the casino $20 gros
      • by kenh ( 9056 )

        The odds of a blackjack game are about 98% meaning the casino get's a 2% margin for hosting the game. Imagine a retailer that bought hammers for $9.80 and sold them for $10. That would be nearly impossible to turn a profit.

        You might want to take a look into the profit margins of a grocery store, I think you'd be surprised how profitable they can be with margins on most items approaching 2%, and unlike a casino, their unsold inventory literally rots on the shelves if unsold.

        • I have never heard of a grocery store that has 2% *gross* margin. Even low cost ones (Aldi/Costco) are, as far as I know, in the 10% markup range.
          • by kenh ( 9056 )

            Here's one story on grocery store profit:

            https://smallbusiness.chron.co... [chron.com]

            Here's an industry group's report over the past 4 decades that shows average grocery store chain (not individual store or item) profits:

            https://www.fmi.org/our-resear... [fmi.org]

            I said:

            margins on most items approaching 2%

            You said:

            I have never heard of a grocery store that has 2% *gross* margin.

            I note you turned the per item profit margin I said to "2% *gross* margin", those two things are not interchangeable. Grocery stores offer prepared foods (cooked chickens, pre-made salads, etc) that offer higher margins, as well as liquor, another high

            • In my original statement, I pointed out that the *gross* margin on BlackJack was 2% and that the net margin is much lower. My entire post was about *gross* margin. A casino has a *gross* margin of 0.5% on craps, 1.5%-2% on Blackjack, and 5-8% on slot machines. I do not claim to be "plugged in" to the grocery store business. But I do know that markups in retail are *never* in the 2% range. The conversation boils down to this.

              Me: Casinos have a 2% gross margin.

              You: Some grocery stores have a 2% [net/g

  • by Shaitan ( 22585 )

    Execs usually don't want you to actually find any showstopper problems, they just want something that passes while being able to show they did due diligence.

    Wonder if they hired them to evaluate the machine they switched to as well.

  • The ultimate answer might not be to shuffle the cards in a conventional sense at all, but instead to generate the shuffled sequence with a computer and then use technology similar to a duplicate bridge dealing machine to put the cards into the generated sequence. The best dealing software has been shown to be mathematically sound and generates properly random decks and hands.
    • by kenh ( 9056 )

      Do you think gamblers will accept a computer *literally* stacking the deck, and will trust the casinos to not do so against the gamblers interest?

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...