Programming puzzle sovling