Challenge
1 |
|
File : quantum_game.py
Solution
Stage1
1 |
|
In stage 1, Allow us to use two gates to rotate qbit.
1 |
|
rand_choice
will spin on X-axis.
In choice1
, we can place Hadamard gate
first.
Change initial state (+Z)
to +X
, then rand_choice
will do nothing with it.
then we put Hadamard gate
again in choice2
, the state will go back to +Z
Finally, put X gate
in the end to make +Z
spin to -Z
The measurement will always be 1
Stage 2
1 |
|
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 0
.
Stage 3
1 |
|
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 sin(t/2)^2
.
we have known that the probability is target/100000 * 100
.
so, we can reverse it : 2 * np.arcsin(np.sqrt(target / 100000))