Lect3 Prob2 machine mind code