added a solvePuzzle method