{"id":27637354,"url":"https://github.com/tushdon2/qiskit_hackathon_iitr_2021","last_synced_at":"2025-06-29T13:03:35.790Z","repository":{"id":46380313,"uuid":"418027374","full_name":"tushdon2/Qiskit_Hackathon_IITR_2021","owner":"tushdon2","description":"Team Random Chaos' repository for Qiskit Fall Fest Hackathon, IITR 2021 (Rock-Paper-Scissors-Lizard-Spock using Quantum Random Number Generator)","archived":false,"fork":false,"pushed_at":"2021-12-16T14:54:05.000Z","size":5214,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T21:17:10.173Z","etag":null,"topics":["eel-python","hand-gesture-recognition","image-classification","machine-learning","noise-qrng","qiskit","qrng","quantum-computing","quantum-randomness","rock-paper-scissors-lizard-spock","tensorflow2","web-based-game","webcamjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tushdon2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-17T05:14:40.000Z","updated_at":"2023-07-03T20:04:48.000Z","dependencies_parsed_at":"2022-08-25T14:30:53.088Z","dependency_job_id":null,"html_url":"https://github.com/tushdon2/Qiskit_Hackathon_IITR_2021","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tushdon2/Qiskit_Hackathon_IITR_2021","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tushdon2%2FQiskit_Hackathon_IITR_2021","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tushdon2%2FQiskit_Hackathon_IITR_2021/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tushdon2%2FQiskit_Hackathon_IITR_2021/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tushdon2%2FQiskit_Hackathon_IITR_2021/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tushdon2","download_url":"https://codeload.github.com/tushdon2/Qiskit_Hackathon_IITR_2021/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tushdon2%2FQiskit_Hackathon_IITR_2021/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262598163,"owners_count":23334668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eel-python","hand-gesture-recognition","image-classification","machine-learning","noise-qrng","qiskit","qrng","quantum-computing","quantum-randomness","rock-paper-scissors-lizard-spock","tensorflow2","web-based-game","webcamjs"],"created_at":"2025-04-23T21:17:07.961Z","updated_at":"2025-06-29T13:03:35.738Z","avatar_url":"https://github.com/tushdon2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Qiskit_Hackathon_IITR_2021\r\nTeam Random Chaos' repository for Qiskit Fall Fest Hackathon, IITR 2021\r\n\r\n## The Problem\r\n\u003cp align = \"center\"\u003e\u003cimg src = \"./assets/img/SSLRP.png\"\u003e\u003c/p\u003e\r\n\u003cp align = \"justify\"\u003eThe classical game of Rock-Paper-Scissors becomes biased when \r\ntwo people play against each other. One may easily catch on to\r\ntheir opponent's strategy if the opponent plays in a regular\r\npattern. One might extend the classical game by introducing new\r\nmoves as in the game Rock-Paper-Scissors-Lizard-Spock to\r\nmitigate this. But even then, the internal psychological biases of\r\nthe human brain might not let the game be truly random,\r\ncreating a stand-off.\u003c/p\u003e\r\n\r\n\u003cp align = \"justify\"\u003eWe propose a solution to this predicament by generating truly\r\nrandom moves using Quantum Random Number Generator. The\r\ncomputer will use the random generated moves to play against a\r\nhuman (who will play by using hand gestures).\u003c/p\u003e\r\n\r\n## Aim of the project\r\n  * Develop a basic understanding of the quantum computing\r\n  * Explore different ways to create a quantum random number generator\r\n  * Take image input from user and identify different hand gesture.\r\n  * Develop a interface to play Rock-Paper-Scissor-Lizard-Spock against quantum computer.\r\n  * Analysing human psychology based strategy against complete randomness.\r\n\r\n## What we achieved in this project\r\n  * Created a Quantum random generator using noise only (over QasmSimulator in Qiskit).\r\n  * Linked Qrng with web game .\r\n  * Train a classical machine learning model using python to identify different hand gestures for rock, paper, scissors, lizard and spock.\r\n  * Developed web interface for game using html, css and javascript.\r\n  * For further info: [Project Presentation](https://github.com/tushdon2/Qiskit_Hackathon_IITR_2021/blob/master/assets/docs/Qiskit%20Fall%20Fest%20Hackathon%20IITR%202021.pdf)\r\n\r\n\r\n## Instructions\r\n1. Clone this repo into your local machine using the command: \r\n```\r\n$ git clone https://github.com/tushdon2/Qiskit_Hackathon_IITR_2021.git\r\n```\r\n2. Change your working directory to the cloned repo and create a Virtual Environment. For example, a virtual environment named `venv` can be created using venv by the command: \r\n```\r\n$ cd Qiskit_Hackathon_IITR_2021\r\n$ python -m venv venv\r\n```\r\n3. Activate the environment:\r\n  * use `.\\venv\\Scripts\\activate` command in **Windows** \r\n  * use `$ source venv/bin/activate` in **MacOS** or **Linux**\r\n  * It can later be deactivated by using the `deactivate` command\r\n4. Install the required libraries and packages from the [`requirements.txt`](./requirements.txt) file \r\n```\r\n$ pip install -r requirements.txt\r\n```\r\n5. Capture dataset images using the [capture_dataset_images.py](./src/capture_dataset_images.py) file. For example, to collect 200 images for **_rock_** gesture, use:\r\n```\r\n$ python3 ./src/capture_dataset_images.py rock 200\r\n```\r\n6. Do this for all the gestures: **_paper_**, **_scissors_**, **_lizard_** and **_spock_**. Also capture images of mundane stuff to classify as **_none_**. Divide the captured images into _**train**_, _**valid**_ and _**test**_ datasets as shown directory structure:\r\n```\r\nassets\r\n  |\r\n  |--data\r\n  |   |\r\n  .   |--train\r\n  .   |   |\r\n  .   |   |-- (all images captured for training)\r\n      |\r\n      |--test (all images captured for testing)\r\n      |\r\n      |--valid (all images captured for validation of model)\r\n```\r\n7. Run the [model_train_and_validate.ipynb](./src/model_train_and_validate.ipynb) and [model_test.ipynb](./src/model_test.ipynb) Jupyter Notebooks to train, validate and test the generated CNN model (will be stored in **_model_** directory in [**_assets_**](./assets) folder).\r\n8. Run the [main.py](./src/main.py) file to play the game.\r\n```\r\n$ python3 ./src/main.py\r\n```\r\n\r\n### **Note :** \r\n* We have used [WebcamJS](https://github.com/jhuckaby/webcamjs) library to capture images. It's already bundled in the [**webcamjs**](./src/web/webcamjs) directory.\r\n* We have tested the code on **Windows** with **Chrome** _Version 94.0.4606.81_ and **Python 3.9**.\r\n* Set the default download location of your browser (**Chrome** advised) to a **captures** folder inside [**assets**](./assets) directory and turn off the **Ask where to save each file before downloading** feature.\r\n* Install [**Downloads Overwrite Already Existing Files**](https://chrome.google.com/webstore/detail/downloads-overwrite-alrea/lddjgfpjnifpeondafidennlcfagekbp) Chrome extension.\r\n\r\n## How to use GUI?\r\n  * Click on \"Configure\" to configure the webcam\r\n  * Now make the hand gesture of whichever symbol you want to choose (i.e rock, paper, scissor, lizard, spock)\r\n  * Click on “Take Snapshot”\r\n  * Continue playing until either you or computer scores 5 points\r\n  * Whoever scores 5 points first, wins the game \r\n  * For starting a new game, reload the game.\r\n \r\n## Rules of the game\r\n   * Scissors decapitates Lizard \r\n   * Scissors cuts Paper\r\n   * Paper covers Rock\r\n   * Rock crushes Lizard\r\n   * Lizard poisons Spock\r\n   * Spock smashes Scissors\r\n   * Scissors decapitates Lizard\r\n   * Lizard eats Paper\r\n   * Paper disproves Spock\r\n   * Spock vaporizes Rock\r\n   * Rock crushes Scissors, as always.\r\n\r\n\u003cp align = \"center\"\u003e\u003cimg src = \"./assets/img/TTBT_rulesOfSSLRP.gif\"\u003e\u003c/p\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftushdon2%2Fqiskit_hackathon_iitr_2021","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftushdon2%2Fqiskit_hackathon_iitr_2021","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftushdon2%2Fqiskit_hackathon_iitr_2021/lists"}