{"id":18056321,"url":"https://github.com/devilkiller-ag/quantum-circuit-game-engine","last_synced_at":"2025-04-11T02:07:04.556Z","repository":{"id":204045993,"uuid":"710986788","full_name":"devilkiller-ag/Quantum-Circuit-Game-Engine","owner":"devilkiller-ag","description":"Quantum Circuit Game Engine for Pygame based Quantum Games","archived":false,"fork":false,"pushed_at":"2024-04-05T14:02:52.000Z","size":53,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T02:06:45.926Z","etag":null,"topics":["quantum-computing","quantum-games"],"latest_commit_sha":null,"homepage":"https://qcge.ashmit.dev/","language":"Python","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/devilkiller-ag.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-27T22:27:29.000Z","updated_at":"2025-02-15T20:44:55.000Z","dependencies_parsed_at":"2023-12-30T03:30:55.432Z","dependency_job_id":"fbbb44dc-34a5-432f-a70a-cead2aecfefa","html_url":"https://github.com/devilkiller-ag/Quantum-Circuit-Game-Engine","commit_stats":null,"previous_names":["devilkiller-ag/quantum-circuit-engine-for-pygame-based-quantum-games","devilkiller-ag/quantum-circuit-game-engine"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilkiller-ag%2FQuantum-Circuit-Game-Engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilkiller-ag%2FQuantum-Circuit-Game-Engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilkiller-ag%2FQuantum-Circuit-Game-Engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilkiller-ag%2FQuantum-Circuit-Game-Engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devilkiller-ag","download_url":"https://codeload.github.com/devilkiller-ag/Quantum-Circuit-Game-Engine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328167,"owners_count":21085261,"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":["quantum-computing","quantum-games"],"created_at":"2024-10-31T01:14:42.088Z","updated_at":"2025-04-11T02:07:04.515Z","avatar_url":"https://github.com/devilkiller-ag.png","language":"Python","funding_links":["https://ko-fi.com/jaisarita"],"categories":[],"sub_categories":[],"readme":"![Quantum Circuit Game Engine](https://github.com/devilkiller-ag/Quantum-Circuit-Game-Engine/assets/43639341/dd998bca-c47b-44fd-8ed2-19724cbc57a2)\n\n\u003ch1\u003eQuantum Circuit Game Engine for Pygame-based Quantum Games\u003c/h1\u003e\n\nThis is a Quantum Circuit Game Engine for integrating Quantum Circuits into your Pygame-based quantum game. You can use it simply by creating an object of the `QuantumCircuitGrid` class stored in the `quantum_circuit.py` file.\n\nThis Quantum Circuit was originaly created for the **QPong Game** developed by \u003ca href='https://huangjunye.github.io/' target='_blank'\u003eJunye Huang\u003c/a\u003e in the \u003ca href=\"https://www.youtube.com/playlist?list=PLOFEBzvs-VvodTkP_rfrs3RWdeWE9aNRD\" target='_blank'\u003e12 Days of Qiskit Program\u003c/a\u003e. I created this engine by re-writing its code located \u003ca href='https://github.com/QPong/qpong-livestream' target='_blank'\u003ehere\u003c/a\u003e to make it modular and abstract for easy use with any quantum game. \n\nThe features I have included are:\n- Modular and Abstract Code.\n- All configurations in one place in the `config.py` file.\n- Developers can create a Quantum Circuit for any number of qubit/wires and circuit width (max. number of gates which can be applied in a wire) of their choice. \n- Easy to change UI by replacing color configs and graphics for gates with those of your choice. \n- Easy to change the size of Quantum Circuit by adjusting `QUANTUM_CIRCUIT_TILE_SIZE`, `GATE_TILE_WIDTH`, and `GATE_TILE_HIEGHT` in the `config.py` file.\n- Easily change controls by changing keys in the `handle_input()` method of the `QuantumCircuitGrid` class.\n\n\n**If this project is helpful for you or you liked my work, consider supporting me through \u003ca href=\"https://ko-fi.com/jaisarita\" target=\"_blank\"\u003eKo.fi🍵\u003c/a\u003e. Also, kindly consider giving a star to this repository.😁**\n\n\u003c!-- ------------------------------------------------------------------------- --\u003e\n\u003ch2\u003eAbout me\u003c/h2\u003e\n\nI am Ashmit JaiSarita Gupta, an Engineering Physics Undergraduate passionate about Quantum Computing, Machine Learning, UI/UX, and Web Development. I have worked on many projects in these fields, participated in hackathons, and am a part of great organizations in these fields. You can explore more about me, my work, and my experience at various organizations through my portfolio website: \u003ca href='https://jaisarita.vercel.app/' target=\"_blank\"\u003ehttps://jaisarita.vercel.app/\u003c/a\u003e ☄️\n\n\u003c!-- ------------------------------------------------------------------------- --\u003e\n\u003ch2\u003eInstallation\u003c/h2\u003e\n\n```bash\npip install qcge\n```\n\u003c!-- ------------------------------------------------------------------------- --\u003e\n\u003ch2\u003eUsage\u003c/h2\u003e\n\nYou can use it simply by creating an object of the `QuantumCircuitGrid` class stored in the `quantum_circuit.py` file. The constructor of `QuantumCircuitGrid` takes these values as argument:\n\n- `position`: Position of the Quantum Circuit in the game window.\n- `num_qubits`: Number of Qubits in the Quantum Circuit.\n- `num_columns`: Circuit width (max. number of gates which can be applied in a wire) of their choice.\n- `tile_size` (Optional, Default Value = 36): Size of single tile unit of the Quantum Circuit. It is the square area containing single gate in the quantum circuit.\n- `gate_dimensions` (Optional Default Value = [24, 24]): [Width, Height] of quantum gates.\n- `background_color` (Optional Default Value = '#444654'): Background Color of the Quantum Circuit.\n- `wire_color` (Optional Default Value = '#ffffff'): Color of Quantum Wire in the Quantum Circuit.\n- `gate_phase_angle_color` (Optional Default Value = '#97ad40'): Color to represent phase angle of Rotation Gates.\n\nYou can run your quantum circuit on BasicAer Simulator by using this function:\n```python\ndef run_quantum_circuit(self, quantum_circuit):\n        simulator = BasicAer.get_backend(\"statevector_simulator\")\n        quantum_circuit.measure_all()\n        transpiled_circuit = transpile(quantum_circuit, simulator)\n        counts = simulator.run(transpiled_circuit, shots=1).result().get_counts()\n        measured_state = int(list(counts.keys())[0], 2)\n        return measured_state\n```\n\n\u003c!-- ------------------------------------------------------------------------- --\u003e\n\u003ch2\u003eConfigurations\u003c/h2\u003e\n\nAll the configurations for Quantum Circuit can be done in the `config.py` file. The controls of the quantum circuit in the game can be changed from the defaults mentioned below by changing keys in the `handle_input()` method of the `QuantumCircuitGrid` class.\n\n- You can change the size of Quantum Circuit by passing optional parameters `tile_size`, and `gate_dimensions` (= [GATE_TILE_WIDTH, GATE_TILE_HIEGHT]) to the `qcge.QuantumCircuitGrid` class as parameters.\n- You can change UI colors by passing optional parameters `background_color`, `wire_color`, and `gate_phase_angle_color` to the `qcge.QuantumCircuitGrid` class as parameters.\n\nDefault values of these optional parameter are:\n```python\ntile_size = 36\ngate_dimensions = [24, 24]\nbackground_color = '#444654'\nwire_color = '#ffffff'\ngate_phase_angle_color = '#97ad40'\n```\n\n\u003c!-- ------------------------------------------------------------------------- --\u003e\n\u003ch2\u003eGame Controls for Building Quantum Circuit\u003c/h2\u003e\n\n- **W, A, S, D Keys:** Move the \"Circuit Cursor\" in the Quantum Circuit to the place where you want to add a gate in the circuit.\n- **Backspace Key:** Remove the gate present at the Circuit Cursor.\n- **Delete Key:** Clear the Quantum Circuit, i.e., remove all gates from the Quantum Circuit.\n- **X Key:** Add X Gate to the quantum circuit.\n- **Y Key:** Add Y Gate to the quantum circuit.\n- **Z Key:** Add Z Gate to the quantum circuit.\n- **H Key:** Add H Gate to the quantum circuit.\n- **C, R, E Keys:** Press **C Key** to convert the X, Y, Z, or H gates into CX, CY, CZ, and CH gates respectively, and then press **R Key** and **F Key** to the control to qubit above or below respectively.\n- **Q and E Keys:** To convert X, Y, and Z into RX, RY, and RZ gates respectively. **Q Key** decreases the rotation angle by π/8 and **E Key** increases the rotation angle by π/8.\n\n\u003c!-- ------------------------------------------------------------------------- --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevilkiller-ag%2Fquantum-circuit-game-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevilkiller-ag%2Fquantum-circuit-game-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevilkiller-ag%2Fquantum-circuit-game-engine/lists"}