|← / →
|move block horizontally
|move block down
|instantly put down block
|pause / unpause
|a screenshot of the game will be downloaded
- Here is a video giving a brief overview of the whole quantum design jam.
What would happen if you combine Tetris with a Quantum computer? The winning entry of the Quantum Design Jam from IBM and Parsons in October 2021 explores just that!
Quantum Tetris game investigates the concept of true randomness in games and celebrates noise—a beautiful imperfection of the current generation of quantum computers. Have you ever wondered what is random? In today's world, classical computers can merely generate pseudo-random numbers using seeds. The promise of a perfect, zero-noise quantum computer hints at the possibility of true randomness.
We decided to use Tetris—a well-known game—to explore the visualise of true random generated by a quantum computer. In classic Tetris, a player can theoretically predict which block appears next, if they knew the seed of the random function. A quantum computer can create truly random numbers, thus ensuring true randomness which cannot be predicted.
Currently, quantum computers, still in their nascency, produce a lot of false values as they perform calculations. Qubits cannot hold their state for long, resulting in occasional erroneous calculations. This phenomenon is called noise. The longer the circuit, the more probable it is that a calculation is disturbed, hence more noise appears.
Usually, noise is an unwanted side effect. However, we could see the potential of using this noise to great effect to supercharge a game of Tetris! We programmed a quantum computer to generate the regular seven kinds of Tetris blocks. The noise produced by the quantum computer created blocks that were not intended, allowing for new blocks that do not fall in the regular 'four pieces attached' Tetris ruleset, creating a whole new Tetris experience. These strange, and irregular "noisy shapes" are a result of the miscalculations which occur when running the calculations on a quantum computer. If you play the the game above, you'll see those new blocks, which are highlighted in red.
Not only is Quantum Tetris a fun game, but it's also a great metaphor for a quantum circuit. The longer you play, the more noisy shapes appear, just like the longer you run a calculation on a quantum computer, the more noise you'll encounter.
- "Pajitnov [the inventor of the original Tetris game] called this game 'Tetris,' a combination of 'tetra' (the Greek word meaning 'four') and 'tennis' (his favorite sport)." Source
- It can also happen that accidentally a real tetromino is generated through the noise. This happens due to the fact, that some tetrominos fit in more than one combination of our grid, and we do not filter them out (yet).
To communicate the noise in quantum, we searched for a simple
way to display binary data—so
1s—the output of a quantum calculation. As we wanted
to focus on the topic noise in quantum operations, we needed to
also find an example which is not only easy to represent in this
binary format, but also an example that showcases the unwanted
results of the binary combinations.
We wanted to create something which allows for the 'noise' generated to add to the experience.
For example, if we tasked a quantum computer to
generate random images consisting of black and white pixels (where
0 is white and
1 is black) , we would not be able to see the noise,
as we wouldn't be able to distinguish between 'true' random outputs, and 'noise' affected random outputs. The results for both
would visually appear to be identical—both would look like scrambled black and white images.
Although we needed to highlight the 'noise', we didn't want the results to be too distracting either. The noise needed to represented by an unwanted element but not to a detrimental degree which would adversely affect the experience. For example, if we assigned the quantum computer to generate an image of the ocean and the 'noise' manifested in the form of unrelated objects appearing in the image, like a tree, that wouldn't be an accurate representation of the concept as trees were not a part of the equation in the first place.
We also wanted to make something which would include elements of play so that the concept is easier to understand and also more fun! This led us to look at popular games, especially older ones that are easier to replicate. We quickly narrowed in on Tetris, as it's popular, and easy to play—an ageless classic.
We started with translating the tetrominos (the Tetris blocks)
into a simple grid, that we could describe with binary digits. Tetris
blocks always consist of
four connected squares. One can
thus can fit all possible "real" tetromino combinations in a
2×4 grid. This can be represented again in a simple
bit array mapping to the single cells of the grid.(Fig. 1)
This way we can map a buffer of eight digits to any existing block
we want. E.g.,
0010 1011 would then translate into
the "L" tetromino.(Fig. 2)
Based on this system, we can generate all possible blocks by only
1s. But in this particular
example, a different combination of these digits would result in unintentional and strange
Tetris blocks. Here the noise affects the regular code
in a very specific way, which makes it a great representation of how noise
alters the usual and anticipated outcome. So, an example of a
noise-tetromino would consist of more or less than the regular four
have them arranged in a different way, generating other combinations, that usually do not exist in the
This is the
2×4 grid we used to fit in all the
different block types. Each cell (from top left to bottom
right) represents a matching index in the bit array. Note
that the indices are counted from right to left.
Here you can see all seven possible combinations for the regular tetrominos and their respective bit-buffer in our grid.
This is an example of tetrominos that could be generated,
that are very different from the classic Tetris blocks. Note: There are
- Due to the limitation of (our access to) the current (Oct 2021) state of quantum computing, we were not able to run the proper circuit yet, even though we know it would theoretically be possible—find the circuit here. We still generated our tetrominos on a quantum computer, albeit in a "hard-coded" way that still includes noise.
The Quantum Circuit
Based on our model which translates the blocks to a simple binary code, we were able to generate the quantum circuit. Generally, by just positioning a qubit in a default superposition, we would receive truly random binary combinations. This however, would result in just random pieces. This would defy our goal.
First, we needed to map all the relevant combinations for the seven tetrominos that exist in the original game. Using the resulting seven binary strings, we can define the logical probabilities after each digit to eventually get an equal distribution of all pieces.(Fig. 4)
Knowing this, we were able to create a relatively straightforward quantum circuit which would only generate these exact seven blocks.(Fig. 5) Theoretically, in a perfect quantum system, only one of these seven blocks should result at the end of the circuit. Running this circuit multiple times would then generate a truly random set of pieces. But (which happens to be the purpose of this project) quantum circuits are not perfect (yet). Due to the very instable state of a qubit, it's possible that a qubit changes its orientation spontaneously, thus affecting the subsequent measurements of its position—which results in the noise within the circuit. Due to this noise, the circuit produces bit arrays that should theoretically not be possible in its layout, which happen to be our red quantum, noisy tetrominos.
The longer a circuit is, the more often a qubit is measured, which makes it more likely that noise is likely to interfere with the result of the calculation. In our case the calculation for one block is fairly long, which increasing the probability of irregular blocks.
This is the visualization that we used to map the
probabilities to our circuit. A branch to the left means if
1 and a branch to the right results in
0. Each column represent a digit of our buffer.
The red numbers indicate the probability that is needed, or
in our case, the superposition the cubit needs to be put in.
At the end of each branch you can see the final buffer and its corresponding tetromino.
This is a part of the quantum circuit that would generate the blocks in the probability described previously. It only shows the first couple of gates and continues in a similar manner for a while. If you are interested, you can find the whole circuit here.
With Quantum Tetris, we want to showcase the beauty of noise generated by quantum computing in a playful manner. Much in the same way, we like imperfections in other media, like analogue photography, or vinyl records.
Another interesting factor in quantum computing that we want to highlight here is the potential of actual, pure randomness. Qubits allow for a real random generation of values, in contrast to the other methods that currently exist, which are based on some sort of seed value which determines the outcome of every randomly generated number.
As a quantum computer is not meant to execute its calculations in real time (like personal computers) but rather, to get a task, calculate it, and then return the results, we precalculated a batch of blocks that are selected in our game. Even though it's not real time generation, the blocks themselves were still actually generated on a real quantum computer from IBM.
To amplify the trait of quantum computing that the longer a circuit is, the more noise will likely appear, we included a simple (not truly quantum) mechanism which will spawn more irregular tetrominos the longer a game is played. The longer you a game of Quantum Tetris goes on for, the more noisy blocks you'll encounter. Play the game above and see for yourself!
Quantum Tetris Arcade
To make the experience even more fun and immersive, we created a physical version of the game—the Quantum Tetris Arcade Edition!(Fig. 6) With a NES-like controller, it feels just like playing the cult classic GameBoy Tetris! When not being actively played, the game continues to drop blocks and functions as a passive art piece.
Quantum Tetris Arcade
Here are some pictures of the final physical Quantum Tetris Arcade.
// More images will follow soon
Build Your Own
Does Quantum Tetris excite you? Would you like to learn more about the project and build one of the Quantum Tetris Arcade Displays yourself? Visit our GitHub for further information and a how-to guide!