problem3 only works up to 3 moves