Google AI Contest: Literate version of the top scoring Haskell entry
jaspervdj.be
jaspervdj.be
When 708 people who spent a significant amount of time solving a problem didn't do what you think is obvious, then perhaps your understanding of the problem isn't as complete as you think it is. Prolog is indeed good for constraint programming, but these programs needed to run in competition with one another. My guess is that a straight-forward Prolog solution isn't fast enough. And once you put enough cuts into the straight-forward solution to help the runtime prune decisions, maybe you'd be better off using something that's faster to begin with.
Perhaps the 708 people aren't familiar enough with constraint programming, just like most java programmers aren't familiar enough with functional programming.
The likely explanation for the inelegant solutions in topcoder and this challenge are that constraint programming is hardly mentioned in undergraduate cs curriculum so even top students are unfamiliar with it.
The winner's heuristics would have been part of the constraints and so would have been the first thing he tried and would be faster because they would have been pruned from the search tree and the solutions not evaluated (incidentally, this is the difference between constraint programming and prolog, in prolog you generate, as he did, and then test, while constraints prune and test). The iterative deepening search is known as breadth first search in prolog/constraint programming and would also be one of the first things you try.
(I entered as the completest Haskell noob imaginable, and was surprised that by making the most elementary revision of the package (which gave your bot the bold strategy of going straight north til it crashed) I managed to place in the top 2/3s. Basically I told it, "if it's the wall, don't go there, take the first of the others available" -- maybe one or two other things. Every klutzy attempt at further 'intelligence' ran into time trouble since I don't yet have any feeling for that kind of optimization. So the package would be excluded as Timed Out if was too slow in too many contests. I consoled myself thinking: At least I my entries never suffered the indignity of the other rejection notice: Garbage Collected)