ritu-thombre99 / QNim-App

QNim game is quantum version of classical Nim game. In QNim game, human/classical computer will play against quantum computer. Developed using pygame in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QNim-App

QNim game is a quantum version of classical Nim game. In QNim game, human/classical computer will play against quantum computer. Developed using pygame in python

This project is implemented under the guidance of James Weaver as part of QAMP (Qiskit Advocate Mentorship Program) Fall-22. Project description can be found here.

To see the strategy quantum computer uses to play against classical player (human/computer), see QNim Checkpoint-1

Steps to install QNim on you system

  • Download QNim-App repository
  • Open Anaconda terminal and cd to the location where QNim-App is downloaded
  • Type pip install -r requirements.txt to install required packages
  • To open game window, type python main.py

How to play QNim game

  • Select amount of bulbs you want in each of the four rows on the light board and who should play first on the configuration page and hit start.
  • You can switch off minimum of 1 bulb and maximum of as many bulbs as you can from any one of the row.
  • You cannot switch off bulbs from multiple row at the same time.
  • Bulbs which you can flip during your turn will turn green.
  • When you are done with your turn, hit the quantum computer button for QC to play.
  • Player switching off the last bulb will lose

QNim API

Rest API developed using Flask in python which takes in the board state and returns the QC move. To start API locally on http://127.0.0.1:5000/, use python qnim_api.py in qnim_api folder.

Mathematical framwork: alt text

Experiment result: alt text

Gameplay video link

Screenshots

Home page: alt text

Home page with current saved game: alt text

Configuration page alt text

Player turn alt text

QC turn alt text

Player won alt text

QC won alt text

Happy playing :)

About

QNim game is quantum version of classical Nim game. In QNim game, human/classical computer will play against quantum computer. Developed using pygame in python


Languages

Language:Python 100.0%