Stockfish has created a quantum-based version of the classic game Guess Who with the power of IBM's qiskit.
Problem: The dilemma that there are not enough games that showcase the weirdness of quantum mechanics.
Brainstorming (possible approaches): In order to address this problem, we wanted to come up with the simplest game that could have a quantum twist to it. During our research, we found that there were already quantum versions of classic games like 2048, Tetris, and Chess. Therefore, we decided to choose a somewhat more niche game, and go with Guess Who? Furthermore, we were also interested in the concept of entangling certain features of characters and having superpositions of features.
Our Approach: Since we wanted to stick to the original game but also provide the player with some experience with quantum circuits, we decided to make two game modes.
One gamemode is more akin to the traditional Guess Who? in the sense that questions are being asked to find out features of the chosen character. Our implementation of quantum mechanics with qiskit come into play with this questioning aspect because of the measurements that players must make. For instance, suppose Player A and Player B are playing against each other, and Player A asks Player B, "Is your hair color black?" Player B cannot directly answer this question because their hair color is not determined yet, so they must measure it. This measurement is important because Player B's hair color can be entangled with another feature of another character, meaning that the collapse of Player B's hair color causes a certain feature of another character to collapse. This superposition and entanglement aspect makes the game interesting because the players use the information that they get from their measurement, combined with what was entangled to the measured qubit to ascertain features of their opponent's character. To make the game more interesting, the objective of the game differs slightly from the original game in that Player A can only win if they have correctly guessed all the features of Player B's character.
Our second gamemode deviates a bit more from the original game because the primary objective of the game is to be able to differentiate between each character by creating circuits and taking measurements with those circuits. For example, the player could choose to place an X gate on the hair of character 1. Then, they could take a measurement to gain more information about the system. This game is a bit more involved because the player needs to create circuits, and take note of what features changed depending on what measurements are taken and what gates are used, so it lends itself to creative strategization. Whereas, the first game mode could be enjoyed by a casual player that does not really understand the underlying principles.
Our Implementation: We implemented the backend in Python, and we made heavy use of qiskit and flask to construct it. Moreover, we used HTML, CSS, and JS for the front end and hosted the flask server on pythonanywhere. Diving into the backend, this is where the quantum happens in the first game. A circuit with 20 qubits is created, and random pairs of qubits are entangled, setting up the traits for the game mechanic. After that the circuit is not interacted with until the next measurement. When a qubit is measured, the circuit returns the value of that measurement and the measurement of any qubits the measured qubit was entangled with.
Results: We were able to properly generate the desired circuit with qiskit. Moreover, we were able to exploit the quantum entanglement and collapsing behaviors of the system to introduce another aspect to the Guess Who game.
General Notes: Repository link: https://github.com/aace217/iQuHACK2024
The Flask server is hosted in server.py in the backend folder
Each of the games are stored in their own python file: cgame.py and rgame.py