exercise 4 puzzle solver