Quantum State Machine