{"id":18601595,"url":"https://github.com/hsk81/quantum-dice","last_synced_at":"2025-05-16T17:33:23.285Z","repository":{"id":44865418,"uuid":"146370322","full_name":"hsk81/quantum-dice","owner":"hsk81","description":"Quantum mechanical 8-sided dice","archived":false,"fork":false,"pushed_at":"2022-12-08T06:35:04.000Z","size":85,"stargazers_count":0,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-18T01:32:57.658Z","etag":null,"topics":["computation","dice","forest","gate","h","quantum","quil","qvm","random","rigetti"],"latest_commit_sha":null,"homepage":"https://www.rigetti.com/","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/hsk81.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":"2018-08-28T00:37:30.000Z","updated_at":"2019-10-21T17:52:01.000Z","dependencies_parsed_at":"2023-01-24T16:30:41.951Z","dependency_job_id":null,"html_url":"https://github.com/hsk81/quantum-dice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsk81%2Fquantum-dice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsk81%2Fquantum-dice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsk81%2Fquantum-dice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsk81%2Fquantum-dice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsk81","download_url":"https://codeload.github.com/hsk81/quantum-dice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254576339,"owners_count":22094345,"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":["computation","dice","forest","gate","h","quantum","quil","qvm","random","rigetti"],"created_at":"2024-11-07T02:08:49.880Z","updated_at":"2025-05-16T17:33:23.264Z","avatar_url":"https://github.com/hsk81.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Quantum Dice: Let's Gamble!\n\nBillions of dollars are at stake! Play now a quantum mechanically enhanced dice to enrich yourself: Roll this brand new kind of a *quantum dice* - which has been built using [Rigetti's](https://www.rigetti.com/) *Forest* API - and beat the odds!\n\n## Installation\n\nTo install the dependencies run:\n\n```bash\npipenv install\n```\n\nTo enable the virtual environment run:\n\n```bash\npipenv shell\n```\n\n## Run: QVM Server\n\nRequires a 64-bit Linux environment:\n\n```bash\n$ ./bin/forest-sdk-2.0.2/qvm --server\n[2018-11-26 12:24:19] Starting server on port 5000.\n```\n\nwith the following run-time dependencies:\n\n```bash\n$ ldd ./bin/forest-sdk-2.0.2/qvm\nlinux-vdso.so.1 (0x00007ffc05919000)\nlibdl.so.2=\u003e /usr/lib/libdl.so.2 (0x00007f8aaaea9000)\nlibpthread.so.0 =\u003e /usr/lib/libpthread.so.0 (0x00007f8aaae88000)\nlibz.so.1 =\u003e /usr/lib/libz.so.1 (0x00007f8aaac71000)\nlibm.so.6 =\u003e /usr/lib/libm.so.6 (0x00007f8aaaaec000)\nlibc.so.6 =\u003e /usr/lib/libc.so.6 (0x00007f8aaa928000)\n/lib64/ld-linux-x86-64.so.2 =\u003e /usr/lib64/ld-linux-x86-64.so.2(0x00007f8aaaed8000)\n```\n\n## Run: `qdice.py`\n\nSimulates `1024` throws of a `8`-sided quantum dice, which has been implemented using `3` Hadamard gates: Sampling those gates results in `3` classical bits, which are then togheter interpreted as the binary representation of a single number in the range `[1..9]`.\n\n```bash\n$ python ./qdice.py --trials=1024 --hadamards=3\n#0001:[ 0 1 0 ] =\u003e 3;\n#0002:[ 1 0 1 ] =\u003e 6;\n#0003:[ 0 0 0 ] =\u003e 1;\n#0004:[ 0 0 0 ] =\u003e 1;\n...\n#1021:[ 0 1 1 ] =\u003e 4;\n#1022:[ 1 1 0 ] =\u003e 7;\n#1023:[ 0 1 1 ] =\u003e 4;\n#1024:[ 0 1 0 ] =\u003e 3;\n```\n\nThe result of the `1024` throws is averaged for each bit and the corresponding number, providing a simple statistics, where the expected distribution is uniform:\n\n```bash\nμ{⟨H(i)⟩}=[ 0.48 0.52 0.41 ], μ{∑H(i)*2^i}=4.46;\n```\n```bash\nσ{⟨H(i)⟩}=[ 0.50 0.50 0.50 ], σ{∑H(i)*2^i}=4.50.\n```\n\n## Run: `qcolor.py`\n\nTransforms the results of the random throws of a quantum dice into an RGB colored image, where the square root of the number of `trials` defines the height and width of the square image; hence `trials` should be a square number. The `simulate` flag controls whether a regular pseudo-random generator should be used to produce the throws.\n\n```bash\n$ python ./qcolor.py --trials=65536 [--simulate]\n```\n\n![Quantum Image](./img/qcolor-qvm.png)\n\n## Copyright\n\n © 2018 Hasan Karahan, https://github.com/hsk81.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsk81%2Fquantum-dice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsk81%2Fquantum-dice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsk81%2Fquantum-dice/lists"}