Skip to content

Instantly share code, notes, and snippets.

View ryan-lam's full-sized avatar
🤪

Ryan Lam ryan-lam

🤪
  • Toronto, Ontario
View GitHub Profile
import qiskit
qc = qiskit.QuantumCircuit(3,3)
for i in range(3):
qc.h(i)
turns = 6
print("Welcome to Quantum PvP!. In this game, there are 3 qubits in a quantum circuit that start off in a superposition state. \
What you (player 1) are trying to do is to get the qubit to collapse into the \"0\" state. Your opponent (player 2) will \
trying to do the same, but they will be trying to get the qubit to collapse into the \"1\" state. \
@ryan-lam
ryan-lam / Part_4.py
Last active November 29, 2019 04:05
Part 4 Code
from pyquil import Program, get_qc, list_quantum_computers
from pyquil.gates import *
import numpy as np
import matplotlib.pyplot as plt
p = Program()
ro = p.declare('ro', 'BIT', 2)
p += X(0)
p += Y(0)
p += H(0)
@ryan-lam
ryan-lam / Part_3.py
Last active November 29, 2019 04:06
Part 3 Code
from pyquil import Program, get_qc, list_quantum_computers
from pyquil.gates import *
import numpy as np
import matplotlib.pyplot as plt
p = Program()
ro = p.declare('ro', 'BIT', 2)
p += X(0)
p += Y(0)
# p += H(0) #Uncomment this line
@ryan-lam
ryan-lam / Part_2.py
Last active November 29, 2019 04:06
Part 2 Code
from pyquil import Program, get_qc, list_quantum_computers
from pyquil.gates import *
import numpy as np
import matplotlib.pyplot as plt
p = Program()
ro = p.declare('ro', 'BIT', 2)
p += X(0)
p += Y(0)
p += CNOT(0, 1)
@ryan-lam
ryan-lam / Part_1.py
Created November 28, 2019 05:18
Part 1 Code
from pyquil import Program, get_qc, list_quantum_computers
from pyquil.gates import *
import numpy as np
import matplotlib.pyplot as plt
p = Program()
ro = p.declare('ro', 'BIT', 2)
p += X(0)
p += Y(0)
p += CNOT(0, 1)

Keybase proof

I hereby claim:

  • I am ryan-lam on github.
  • I am ryanlam285 (https://keybase.io/ryanlam285) on keybase.
  • I have a public key ASBSpgN13Vi0KFvzAcEITbQiYgfarljoapjHXN3RsQhurgo

To claim this, I am signing this object: