cmps146 project 2 fsm implementation