puzzle solving working