Quantum Number Generator

This weekend I participated in a Quantum Computing Hackathon where many other individuals and I got the chance to learn and apply our knowledge. Our team, the Quantum Geese, decided to take the game approach to the challenge. We knew we wanted to implement a random number generator using a quantum circuit and use this in a fun, simple game.

We started by creating a random number generator using the IBM quantum simulator. Our RNG used a quantum circuit with 1 qubit, 1 classical but, a Hadamard gate, and measurement. We used the measurement of the |+> state to generate a random bit and repeated this to get a bit string which would later be converted into an integer.

Circuit for Quantum Number Generator

At this point, we realized this type of RNG wouldn’t have a uniform distribution across all numbers in the range we were generating because when converting from binary → integer, there would be a higher chance of generating bigger numbers. In the future, we’d love to implement a truly random QRNG in our number-guessing game.

For the sake of the challenge, we continued with that version of our QRNG and created a number-guessing game. First, the game creates a random number with our QRNG, and the user is told to guess a number between a range based on difficulty. After making each guess, the game informs the user of whether they are warmer or colder than the correct number from their last guess. This continues until the user guesses the correct number. Eventually, we made a version of the game where the player races with a quantum computer to try to guess the number before the computer does. The quantum computer makes one guess per turn, just like the user, and each guess is random (guesses generated with our QRNG), but the quantum computer keeps track of guesses it already made and guesses that the player already made. The game ends when either the quantum computer or the player guesses correctly. This was the Quantum Geese’s product for iQuHACK 2023!

Number Guessing Game

At some point after the event, we decided to continue trying to implement a way to make the quantum computer compete against the individual. Through some research, it has been discovered that we can apply the Bernstein-Vazirani Algorithm to our code. Essentially, we can find and return a hidden classical string of bits using this algorithm.

Quantum Guesser Circuit

Throughout the process of creating this game, we thought of several ideas to make the game better or make better use of the quantum computer. We would’ve liked to implement a better algorithm for the quantum computer to guess numbers faster. Our original game has 3 game modes: easy, medium, and hard. Easy has the user guess a number 1–100, medium 1–10, and hard 1–5. The reason for this is the quantum computer makes guesses at random, so the fewer options there are, the easier it is for the quantum computer to guess correctly. Because of this, we would like to explore ways for the quantum computer to guess faster like Grover’s algorithm, or by having the quantum computer guess a binary number instead of converting it to an integer. We would have to consider the speed of the quantum computer’s algorithm, and the speed with which the user can reasonably guess.

Blog Post Contributors: Kevin Cheng, Adonis Serrano, Kaylee Sweet, Zara Yu

--

--