状態遷移機械
State transition machine