Naive Knight's Tour in Haskell 11 Mar 2009
So tonight I was helping a friend with a CS 134 assignment that involved a recursive solution to the Knight’s Tour problem. The assignment included a rather ugly solution in Java and I wondered what a comparable solution in Haskell might look like. I spent the past few minutes hacking together such a function.
It works (as far as I can tell) but it’s unbearably slow. Two optimizations come to mind: using a map rather than a list to store the visited squares and using a heuristic to select the next move location. The latter is implemented in the Java version; if motivation strikes I’ll post a better/faster(/harder/stronger) version.