Learn Quantum Computing Through Puzzles!

Learn now!
Learn Quantum Computing Through Puzzles!

Quantum computing has the potential to revolutionize technology. While classical computing involves the use of bits (zeros and ones), to represent data, quantum computers benefit from the ability of “quantum bits” to be in a state of superposition. The quantum equivalent of “bits” are “qubits” and the phenomenon of superposition allows these quantum entities to be in a state which is both zero and one at the same time! Stepping into the quantum world and getting acquainted with these non-intuitive quantum concepts can be tough.

To make the introduction to quantum computing fun and easy, we developed QLogic, a puzzle game based on quantum bits (qubits) and the logic gates that are commonly used in the field. Our aim is to subtly get the players familiar with the idea of qubits and quantum operations. We introduce concepts like superposition and entanglement as additional tips for our curious puzzlers. According to us, this makes the players question the rules of the quantum world and makes them eager to learn more about it.

The game currently has three different types of puzzles:

Normal Mode:

Here, the levels require the players to take a system of qubits from one state to another by applying some common gates, such as the Pauli-X gate (not-gate), the Pauli-Z gate, the Hadamard gate, and their corresponding controlled gates. We currently have 75 levels with up to 3-qubit systems. The levels have been created so as to cover all the different ways a qubit-system may transit. This maintains a variety in levels and also helps avoid repetition.

The levels expect the player to optimize their moves according to the constraints: While some levels require you to get to the final state in minimum possible moves, others demand you to reach the result as quickly as possible in order to obtain 3 stars!

Time Attack mode:

Here, the user needs to achieve as many unique states as possible within a time limit. This helps in giving them a complete overview of the quantum states. This is a fun mode to set high scores, beat them, and compete. Players can play with 2 or 3 qubits, with 60 and 90 seconds respectively.

Playground Mode:

This is meant to be an experimenting space for players. Here, one can think of an experiment and execute without worrying about the time limit or the moves’ counter. The playground will soon have a ‘Normalization toggle’ and the option to input an initial state instead of the default |0> state.


All the gate transformations performed in the game follow the rules of Vector Algebra to maintain consistency in programming all operations. We input the initial states as vectors and the gates are represented as matrices. The resultant system state is obtained from the matrix multiplication of the gate matrix and the state vector.

The gates are never performed on individual qubits when working with a system of 2 or 3 qubits. Our algorithms create a matrix to be applied to the entire system and that is used to obtain the final state. This gives us the advantage of not having to worry about even the most complex entanglements that the system might have.

Moreover, even control gates are generated using an algorithm to create a control gate matrix so as to generalize the process for whichever qubit is chosen as the control and whichever one is chosen as a target. As a result, we don’t have to worry about having to generate controlled gates for any basic gate. The same code can be used for CX, CZ, CH, or any other gate that may be added in the future.


Organizing Levels

Creating and ordering levels with gradually increasing difficulty and finding minimum possible moves was another excruciating task that required multiple checks. The levels were created considering different combinations of terms in case of multiple qubits. This ensured that the levels cover a wide variety of problems and are non-repetitive.

Normalization vs Gamification

Adding the eerie normalization factors, especially that leading from a Hadamard operation could make QLogic look less like a game and unnecessarily complicated for beginners. Consequently, we decided to ignore the amplitude part to focus more on making the levels look like puzzles which would teach the players to tackle multi-qubit systems.

Programming Gate Operations

Gate operations had to be programmed in a way that it could handle superposition and entanglement well. Gates cannot be applied to individual qubits if the system is entangled. To avoid problems like these, we create a 2n ⊗ 2n dimensional matrix for the whole system of n qubits every time a gate is applied on a qubit. This was especially challenging in the case of controlled gates where the matrix depends on the relative indexes of control and the target qubit. Looking at the fundamentals of gate operations and vector algebra helped us design a generalized function for generating controlled-gate matrices.

Get in Touch

We are working on adding new features and modes which would make the game more informative and fun to play. Do try out the game on the android store and follow us on Instagram and Twitter for the latest updates! If you have feedback/suggestions on how we can improve or make the game more interesting, you can get in touch directly with the QLogic team via our Telegram group.

Contributors: Shreyas Nisal, Namita Nisal, and Nikita Saxena

Continue Reading