Introducing the world’s first game for a quantum computer

This is the first time a computer game was run on a quantum computer. I won!

I just made a computer game. Not for the PS4 or XBox or even the Nintendo Switch. I made it for a quantum computer. I played it on an actual, real-life quantum computer, and you can too.

It is not a very complex game. Current quantum computers aren’t capable of all that much. It’s basically a quantum version of rock/paper/scissors. But it does contain a glimmer of what will make quantum computing special.

The quantum computer I use is the one made by IBM, and offered up to the cloud for us all to mess around with.

It has five quantum bits. One of them is going to act as a referee, telling us who wins. The other four are all potential opponents. Though we’ll only ever play against one at a time.

To make a game for quantum bits, we have look at the set of things that we are allowed to do to them. For inspiration, we can look at what’s possible for normal bits.

The simplest thing we can do with a normal bit is called a NOT gate. It flips bits from 0 to 1 and 1 to 0. Quantum computers can do these to, but they can also be a bit more fancy. For example, they can do half a NOT, leaving the quantum bit in a strange limbo state between 0 and 1. A quantum superposition, just like Schrödinger’s cat.

Actually, there are two ways to do half a NOT. We’ll abuse notational slightly and call them S and S dagger. If you do two S gates, you’ll get a whole NOT. No surprise there: that’s what two halves do! Two S dagger gates will also give you a NOT. But if you have one of each, they’ll cancel out. You’ll end up back where you started.

This is the mechanic behind the game. We’ll have two players. One wants to do a NOT to the referee bit. The other wants to leave it as it is. Both can choose one of two moves: S and S dagger. If they both choose the same, the one who wants the NOT wins. If they choose different, the other one wins.

One of the players is going to be a human. The other will be another quantum bit. We’ll put the quantum player in a superposition of choosing S and S dagger. Then we’ll interact it with the referee, putting them in a superposition of doing an S and doing and S dagger. We will be in a state of winning and losing at the same time. Not even the gods will know which way it will go.

Then we measure. We look at the referee. We see if it’s been changed by a NOT or not. If it has, we win!

This may all seem a bit random. Just as rock/paper/scissors does. But actually, there are tactics for both. Play enough and you’ll find that your opponent isn’t completely random. Noise messes up the pure, unadulterated randomness of quantum bits. Your opponents will become mortal and weak. Each experiences noise differently, so they’ll all have a different character to learn. They will have biases you can exploit, ensuring that you come out on top most of the time. Though that may just mean winning 51% of the time rather than 50%.

Unless you get IBM to build you a quantum processor of your own, you probably won’t be getting too well acquainted with your quantum frenemies. You’ll only be able to run a few games a day. The main fun will come in knowing that you are using a quantum computer, cutting edge technology, to play a crappy rock/paper/scissors clone. If that’s not living the dream. I don’t know what is.

The game is available in two versions, both available here. The game is best played using the ProjectQ version (using the .py file). It can also be played directly using the IBM Quantum Experience interface (using the .qasm file). In either case, you’ll need a Quantum Experience account to access their device.

I’ve now also made a two player game: Quantum Battleships!