Puzzles provide many hours of applied fun beyond any perfunctory tasks that occupy our days. When your son or daughter receives a snake cube puzzle as a Christmas gift — and it turns out to be deceptively complex — you can sit there for hours to try to figure out a solution, or use the power of Python to sort out the serpentine conundrum and use brute-force to solve it.
Finding himself in such a scenario, [Randy Nuss] walks us through his solution while giving insight into how he approaches writing code — learning other methods of problem solving can be a valuable experience in itself, and thematically fitting, considering this particular case! [Nuss] includes his final code near the end of his post, but his write up instead outlines it in enough detail that would guide others along the correct path. Once it ran successfully, he was cajoled into creating a visualization of the solution since the actual code completes in less than a second.
If a hack is a means to make a given task easier to accomplish, then some fancy coding to solve a puzzle — while perhaps defeating the purpose — is arguably still a hack that simply uses a different avenue. Sometimes, the puzzle winds up being the hack itself when you are gifting something special.