Quantum Gambling Game

Have you ever heard of quantum computing? Know what makes it so special? Well, many scientists (and their funding agencies) are hoping that quantum computing's secrets just might help get them rich.

I can't promise you that. But I can share this quantum gambling game I made with you. Although it looks simple enough on the surface, this betting game actually reveals an interesting application of quantum computing, the science turning "spooky" physics into solving real problems.

I'll explain more about strategy and its relation to quantum algorithms below, but for now, try the game out! Read below for more instructions.



Guess the Quantum Card!




Instructions

The goal is to get the biggest bet you can onto the Ace of Spades, and to keep your bet off of the decoy cards. But the trick is that during the game none of the cards are ever revealed to you.

You start the game by placing your initial bets on whatever cards you want.

After that, you have your choice of two moves, which you get to repeat until you decide you're done.

  1. Trade Bets, meaning any money on the losing cards goes to the dealer, while the money on the winning card stays the same.
  2. Redistribute, meaning you reverse all the bets around the average bet value. So the dealer's money comes back to your side of the average, and vice versa.

The redistribute move might seem confusing, so here's what it does graphically.

How the Redistribute Move Works

During the redistribution, the dealer basically just moves the money around so that places where the money is on the dealer's side shift back to places where you still have money. The math can get really complicated based on how many different bets there are going, but it boils down to just flipping the bets like in the graphic.

Throughout the game, all the money stays on the table. But unfortunately for you, even though the money is changing hands, the dealer never tells you whether a given bet is yours or his on the table.

Whenever you want, you can end the game. At that point, the dealer checks how much money there is on the winning card and gives you back two times that amount. He takes everything else.

So can you play?
And can you figure out how to win... every time?



Some Quantum Hints

OK, so you're stumped. Here are some hints.

I mentioned that it's possible to win every time—not just most of the time. That should be a clue that the game doesn't rely on guessing.

A second clue to point out is that the Trade Bets operation "undoes itself." That means that if you Trade Bets twice in a row, that's the same thing as not trading bets at all. Take a minute to understand why that's true.

Finally, I'll just tell you that repeating the Redistribute operation twice in a row isn't necessary to solve the problem.

If you really don't have any idea what I'm talking about, check out this appendix at the bottom of the page for more info.

Now give it another try.

Time out: how is quantum computing supposed to help me?

For quantum computing, it's all about using fewer iterations to get the same job done. A quantum algorithm aims to take a problem that would take billions of calculations on a classical computer and turn it into just hundreds of quantum calculations.

For example, how long could it take you to find the card by guessing in the classical world? If there are 8 cards you could have to guess 8 times. But for the quantum algorithm on which this game is based, you would be guaranteed to find the card with just 2 guesses. How does it do that? Well, you'll have to read on to find out.

But with the 2 repetitions in mind, try the game out again.

How to win the Game

The way to win every time starts with eliminating all guessing. What I mean by "no guessing" is that the initial configuration of bets must be the same for every card. For example, you can just bet 1 on each card.

After this we just start trying operations. Because Redistributing on all 1s doesn't change the bet values, we know that we start by Trading Bets with the dealer and then we Redistribute. We could redistribute over and over, but it turns out that won't help (although I don't know why. If you know, put it in the comments). At this point, we just have to toggle back and forth between Trading and Redistributing operations.

If we repeat those operations just the right number of times, our initial bets will work their way onto the winning card. Now we just need to figure out how many times to repeat those moves.

It turns out that the right number of repetitions is two. There's a reason that you have to repeat the pair of operations exactly twice, but I have to wait until after I explain the quantum mechanics to get to that. For now, just try playing it again and show yourself that it actually does work.


Quantum Information and Grover's Algorithm

The two moves in the game are really just classical ways to describe more "spooky" operators from quantum computing. And the money gained at the end of the game is analogous to your probability of finding a solution to the problem using a search algorithm.

The Trading Bets operation would be called a Quantum Oracle, which by itself doesn't tell you which solution is right, but will confirm if you have the right answer at the end (by giving you money or taking it). And the Redistribute move is a Grover Diffusion Operator, which essentially lets information about the correct answer "diffuse" from wrong answers. (Note that this is way more complicated than I can explain, and to understand it for real you might need to do more reading (or even take a class) on the subject.)

When you repeat these two operations back to back, you end up performing Grover's Algorithm, a technique proven to find the right information in a database (i.e. the cards). Lov Grover (not Love, Grover) discovered this way of finding information back in the 90s. He was working on a method to compute inverses by letting a quantum function (i.e. the dealer) perform operations (i.e. Trading Bets) that we couldn't see in the classical world (i.e. on our side of the betting table). What was amazing about it was that it allowed you to perform the calculation many fewer times than you would using a classical (asking "Hey, is it that card?") approach.

In the above game, you only need to repeat the procedure 2 times. Whereas to find the card by guessing, you might have to try 8 times. If you want to learn more about why it's exactly 2, I recommend this in depth article on the subject.

(And to learn more about Grover's algorithm with cool visualizations, check out this tutorial from Twisted Oak Studios.


So what's the big deal?

In the end, what's really important about Grover's algorithm is that this isn't just a mathematical artifact. The crazy laws of quantum mechanics somehow make it possible to perform these operation on real materials. This means that it can be used to find real answers to questions that we can't solve fast enough with current computers.

Unfortunately, building quantum computers is turning out to be insanely hard so currently we can still do better with classical computers. But hopefully someday soon, a big breakthrough will make this technology possible.

I hope this whetted your appetite to learn more about quantum computing. Or at the least, it's a fun little puzzle to show your friends.


Playing more with quantum computers

If you want to work more on this, feel free to check out my code. For starters, you can find the javascript for the game on CodePen here. If you're more interested about the quantum details, you can also check out this project on Github that implements quantum computing gates as MATLAB matrix operations.

.
.
.

Appendix: Basic Primer on the Quantum Betting Game

In case you need a little background about betting and guessing games, here's a little Appendix that will help fill you in.


Previous
Next Post »

5 comments

Write comments
Adam Hammond
AUTHOR
January 22, 2015 at 9:34 AM delete

6 iterations of the algorithm works better than 2.

Reply
avatar
Will McFadden
AUTHOR
January 22, 2015 at 10:55 AM delete

Good point. The height of the peak actually increases the closer you are to an integer multiple of the irrational number ~ pi/4*(N)^(1/2), where N is the number of cards.

2 is just the first time it gets close to that, and you can probably do even better than 6 if you have the patience.

Check out the wikipedia to see why

http://en.wikipedia.org/wiki/Grover%27s_algorithm#Geometric_proof_of_correctness

Reply
avatar
sirking
AUTHOR
January 20, 2016 at 2:35 AM delete

It proved to be Very helpful to me and I am sure to all the commentators here!
Where To Bet

Reply
avatar
Jade Graham
AUTHOR
May 4, 2016 at 2:26 PM delete

These checks were placed onto cards either glued down or drawn onto a faro board. online casino

Reply
avatar
Aftab Khatri
AUTHOR
May 23, 2018 at 12:34 PM delete

회원가입 등을 통해 개인정보의 수집, 이용, 제공에 대해 귀하께서 동의하신 내용을 귀하는 언제든지 철회할 수 있습니다. 동의철회는 웹사이트 및 개인정보관리책임자에게 E-mail 등으로 연락하시면 즉시 개인정보의 삭제 등 필요한 조치를 하겠습니다. 홀덤 사이트

Reply
avatar