dan.doel: > Here's a clean-up of my code (it even fits within the line-length limit of my > mail client :)). Note that it's pretty much exactly the Python algorithm. > When > the Python program finds a solution, it prints the board and exits. Since > that's evil IO type stuff, we noble functional folk instead set up an exit > continuation using callCC, and call it when we find a solution. :) > > I haven't bothered testing it against the Python version, but the > backtracking > solution I wrote with the Logic monad (and Data.Map) took around 50% more > time > than this.
I've created a wiki page, http://haskell.org/haskellwiki/The_Knights_Tour I note the LogicT version is the shortest so far. -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe