๐ŸŒ  Inspiration

This weekend I wanted to create something cool ๐ŸงŠ so I decided to bring back a 1990s game - Minesweepers with a Quantum Computing twist. Quanticorn takes inspiration from Minesweeper to teach you about some of the bizarre concepts in Quantum Computing using a gamified environment. The tiles in the game are mapped to actual qubits (i.e. Quantum bits) and therefore mimic the behaviour of qubits.

Trivia - during testing the game was run on a Quantum computer simulator but for the final demo, the game was run on the (real) IBM Quantum computer.

Besides, the name Quanticorn comes from Quantum + Unicorn, ๐Ÿฆ„ so this is a child-friendly version of Minesweeper with the player having to avoid clicking on lightning bolts โšก instead of bombs. ๐Ÿ’ฃ

โš™๏ธWhat it does

  • Quanticorn is a python based game that uses a Quantum Computing Library. Each tile in the game is mapped to a qubit (tile --> qubit). The tiles with lightning bolts are placed randomly using a quantum random number generators. Clicking on the tile reveals a number representing the count of the lightning bolts surrounding the tile. Clicking on a tile with a lightning bolt makes you lose the game (well, there's a 50-50 chance, read ahead to find out). One tile in the game is also assigned to a unicorn. If you click on the tile with a unicorn, you win the game.
  • Here's the twist:
  • A Hadamard gate is applied to each qubit (i.e. the tile) in the game. (A Hadamard gate is a logical gate which when applied to a qubit puts the qubit into superposition - which means the qubit is both a 0 and a 1 at the same time. Although, it collapses to one value when the qubit is measured). Once the player clicks on a tile, the value of the qubit is measured and it collapses into one of the two states (0 or 1). It has a 50 per cent chance of collapsing to a 1 and if the output is 1, clicking on the tile with a lightning bolt will not affect your progress of the game and you can continue playing.
  • A Hadamard gate is also applied to the other tiles which means that some tiles will be locked and will not reveal the number of lightning bolts surrounding the tile.

๐Ÿ’ป How I built it

The game is written in python and uses the Tkinter GUI toolkit. The tiles are mapped to qubits using a framework for quantum computing - qiskit. This is used along with qiskit-ibm-provider to access the Quantum Computer simulator from IBM. Finally, a python interface - quantumrandom, is used for interacting with ANU Quantum Random Number Generator

โ›ฐ๏ธ Challenges I ran into

I initially started off with a flask application, although, I realised that integrating a game on flask app would be harder than expected, so I decided to make a Tkinter application instead. Given that this was my first experience of programming a game - completing the logic of the game with qubits took some time and I initially created a console-based game to verify that my application was behaving expectedly. I spent the last few hours of the hackathon creating the frontend of the application. I decided to work by myself in this hackathon which meant that I had to multitask and manage my time efficiently to complete the game on time for submission. I also struggled quite a bit with the GUI initially, and although, it works, there is definitely a scope for improvement. The visuals of the game are something I hope to work on in the future.

๐Ÿ† What I learned

This hackathon has been a great learning experience for me. From learning about quantum computing through youtube videos to implementing my first game that uses qubits, I am very proud of what I have been able to accomplish in a short frame of time. This would definitely be my coolest hackathon experience!

๐Ÿ”ฎ What's next for Quanticorn

I wanted to experiment with quantum entanglement but I was limited with time. In the future, I hope to add a feature in the game which mimics quantum entanglement by entangling random tiles with each other, where revealing one tile would reveal its pair as well. This would add an additional layer of uncertainty to the game as the revealed tile could also reveal or a lightning bolt - helping you win or lose the game. Furthermore, I plan on making the game multiplayer by adding a realtime functionality, using a pusher such as Vue.

Built With

  • pillow
  • python
  • qiskit
  • quantumrandom
  • tkinter
Share this project:

Updates