A Link to Quantum
Welcome to "A Link to Quantum", a collection of mini video-games that run on a quantum computer! Inspired by retro classics such as Zelda and Block-Out, this work is a result of a collaboration between James Wootton (University of Basel) of Quantum Battleships and Quantum Awesomeness fame, Jonathan DuBois (Lawrence Livermore National Laboratory) and M. Sohaib Alam (myself), and that won us a prize at a quantum computing hackathon hosted by Rigetti Computing on 7 April, 2018.
To play the games, you need to have the following installed (which work best with Python 3):
- pyquil (http://pyquil.readthedocs.io/en/latest/)
- pygame (https://www.pygame.org/news)
- blender (https://www.blender.org/) -- for additional installation instructions, see readme_install.txt
Once those packages are installed, run overworld.py like you would any other python file (Note: on a Mac, you would need to run "pythonw overworld.py" instead of "python overworld.py"). In Overworld, you play the blue dot (controllable by the arrow keys on your keyboard) that is exploring a world generated by the entanglement correlations of quantum mechanics. In four places on this map lie the key to four games you can play within this world. Each of the games can be accessed and played once in each session of Overworld:
- Quantum Block-out (top-middle most cell) -- Use left/right arrrow keys to move your bar, E/R to switch between quantum gates, Q to create a fireball. Enjoy!
- Quantum Darts (bottom-middle most cell) -- Use your mouse to hit within the dartboard. In each round, the 1st dartboard appears against a blue screen, and the 2nd against a red screen. The object of the game is to remember where the 1st dartboard was after striking the 2nd one, and to help you remember, a silhouette of the previous dartboard appears. Sounds easy enough, right? But since these are quantum dartboards, are they always where they are supposed to be? If you strike in the right place, you get a score; if you strike at the wrong position, you get 0; if you don't strike inside a dartboard at all, you get a negative score. As the game progresses, the darboard axes start to align and scoring gets easier. Can you reach a score of 10 in less than 20 attempts? Can you score 20 in less than 33? (this game is actually based on the uncertainty involved in non-commuting observables of quantum mechanics, see https://en.wikipedia.org/wiki/Stern%E2%80%93Gerlach_experiment for more background)
- Quantum penny flip classical/quantum (left-middle most cell) -- Ever watched Star Trek: The Next Generation? Q challenges Picard to a game of penny flips. Picard is to place a penny heads up. Q, then Picard, then Q again each take turns to either flip the penny or not. If the penny lands head up, then Q wins, otherwise Picard wins. At the start of the game, the penny has been placed heads up. Q (the square at the top) takes the 1st turn, followed by Picard (the square at the bottom), followed by Q again. You can move either square left/right using the keyboard during each of their turns. Where you are on the horizontal axis determines your strategy for that player: for Q, the (default) left-most position corresponds to a strategy of "never flip the coin", the right-most to a strategy of "always flip the coin", and the one exactly in the middle to a 50/50 chance of flipping the coin. Once you've decided on a strategy, hit the space-bar to lock down your strategy. Similarly, for Picard, the left-most position corresponds to a strategy of never flipping, the right-most to always flipping, the one exactly in the middle to a 50/50 chance of flipping. Once you lock down Q's 2nd strategy choice, a destruction bar appears and moves towards the player that has lost. If they both win/lose in equal amounts on average, the destruction bar can't decide which way to go! Now if each player were to pick the 50/50 strategy, then reason ought to have it that they would both win in equal amounts over several rounds. Right? But wait! Q has a quantum strategy, whereas Picard only has a classical one (*). If Q always chooses to play the 50/50 strategy in each round, can you get Picard to win against him? (see https://arxiv.org/abs/quant-ph/9804010 for more)
- Quantum penny flip quantum/quantum (right-middle most cell) -- You are faced with the same scenario as the game above. Only now, Picard too has access to a quantum strategy. If Q continues to play the 50/50 strategy in both his rounds, can you pick a strategy for Picard that will draw the match and make the destruction bar hover between the two? Can you pick a strategy for Picard that will win him against Q?
(*) You can also play the classical/classical and quantum/classical versions of this game by separately running meyer_classical_classical_game.py or meyer_quantum_classical_game.py respectively.