# Turn a qubit a little more each time and watch the chance of 1 grow.
import math
from tiny_qsim import RY, start, apply

print("angle      chance of 1")
for step in range(9):
    angle = step * math.pi / 8
    state = start(1)
    apply(state, RY(angle), 0, 1)
    p = state[1] * state[1]
    print(f"  {step}/8 pi   {p:.3f}  " + "#" * int(p * 40 + 0.5))
print("The chance follows a smooth curve: sin(angle / 2) squared.")
