Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHZ game #13

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 45 additions & 314 deletions GHZ-Game.ipynb

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions GHZGame/ghzGame.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
from qiskit import execute, BasicAer
from qiskit import transpile
from qiskit.providers.basic_provider import BasicProvider
from random import randint

def Alice(AlicesColor, AlicesShape): global a_color; global a_shape; a_color=AlicesColor; a_shape = AlicesShape;
Expand Down Expand Up @@ -86,9 +87,10 @@ def yyx(qc, q):
return qc

def simulate(qc, q, c, s):
backend = BasicAer.get_backend('qasm_simulator') # define the backend
backend = BasicProvider().get_backend('basic_simulator') # define the backend
qc.measure(q,c)
job = execute(qc, backend, shots=s) # run the job simulation
transpiled_circuit = transpile(qc, backend)
job = backend.run(transpiled_circuit, shots=s) # run the job simulation
result = job.result() # grab the result
counts = result.get_counts(qc) # results for the number of runs
return counts
Expand Down