Quantum computing is so interesting!
File : quantum_game.py
for i in range(100):
In stage 1, Allow us to use two gates to rotate qbit.
rand_choice will spin on X-axis.
choice1, we can place
Hadamard gate first.
initial state (+Z) to
rand_choice will do nothing with it.
then we put
Hadamard gate again in
choice2, the state will go back to
X gate in the end to make
+Z spin to
The measurement will always be
your_choice = self.get_choice()
In stage 2, this challenge require you to defeat your solution in stage 1.
this challenge is:
H + ? + H + X
In this case, spin
Y-axis is well.
H + Y + H + X will make everything go back to
target = random.randint(1000, 99000)
In stage 3, this time they require your to turn as many head coin as they are.
We must find out what the axis they use.
The probability that the state of the angle t with the X axis on the YZ plane is 1 is
we have known that the probability is
target/100000 * 100.
so, we can reverse it :
2 * np.arcsin(np.sqrt(target / 100000))