Fixed inf loop in generateNewPuzzle