Google AI Challenge: Winner post-mortem and source code
a1k0n.net
a1k0n.net
What I take from it is being more convinced that the claims of dramatically increased productivity from other languages, in practical terms, are at best extremely overblown. If this isn't a practical problem where a Haskell or Scheme programmer could be competitive using advantages of those languages, it really makes me question what is.
The other thing I find interesting is the lack of Java entries. Java is as widely-known as C++, but there's only one Java entry in the top 100, and even in the top 200 Java is only about as common as Haskell or Ruby, and far less common than Python.
And secondly, most bots relied on minimax, which is a brute force algorithm. Performance was a big difference. For example, a friend of mine ported my code from C# to C++ (from compiled language to other compiled language) and got in the top 50 (I finished 81st), this without any changes to the algorithm.
I would expect this effect to utterly dominate any actual differences in languages right now. Comparing programming-contest-experts-in-C++ to newbies-with-$FAVORITE_LANGUAGE is not going to be a fair fight in something like this, where algorithms and insights dominate.
If TopCoder et al took the same suite of languages, and had for long enough that skills had equalized after the first mover network effects to whatever was really best for this sort of thing, we'd be able to make a better guess about what languages are good for what. (I would then conclude that I still don't really care because I'm not usually doing programming contests. But it would at least mean something, unlike the current results.)
Surely everyone experienced at these competitions would quickly figure out that lisp et al are huge competitive advantages, and everyone would quickly switch.
From what I've seen working with some living legends in computer science the language makes almost no difference in actual productivity, it's just personal preference.
It's just trading one performance characteristic for another. Every language has it's sweet spot, and if you know them you are just as productive in that as another.
If you aren't productive in a specific language, you are doing it wrong.
You missed the part where I pointed out that current major competitions don't accept arbitrary languages. That's the key point of my post. All else is not even. If they did accept arbitrary languages I would accept your logic, given sufficient time for network effects to wear off.
Otherwise, if you're going to argue that it's the people and their experience that really matter, you reduce back down to my point, which is that all the experienced people have their experience in C++ as cost-of-entry to the major contest sites and thus tended to use C++ as the language they have by orders of magnitude the most experience in by virtue of it being the only sane choice of the ones actually offered, rather than any intrinsic advantage C++ has over the non-offered languages.
In this competition, if you wanted to use another language, you just needed to make a starter package (a stupid bot) and some instructions to get the compiler working on their end. So in this competition, arbitrary languages where accepted.
See, for example, the comments on this page: http://www.spoj.pl/problems/ABCDEF/
If that were true how can we explain the results in this paper
http://www.macs.hw.ac.uk/~trinder/papers/ICFP2007.pdf
which compared writing the same large application in Erlang, Haskell and C++ and showed the C++ program needed 40 times more code than Haskell and concluded:
"The high-level constructs dramatically reduce application size, thereby reducing development time and aiding maintenance."
First the value of prototyping was reduced by the length of the contest (as opposed to the contest being 48 hours) and by the fact the forum members provided some good strategies to the winner so he did not have to uncover them himself.
Second it turned out one of the most effective algorithms involved brute-force, an area which C/C++ excels at.
Actually it is surprising Haskell, Scheme, and Python ended up in the top 10% at all, I would like to see how they did it.
Once the algorithms were solidified, the people that knew C++ implemented them as optimized as possible. The bots had a limit of 1 second for processing per move. As soon as the ideal algorithms were understood, it was a no brainer to make it as fast as possible.
It really just came down to raw speed in the end, which is hardly representative of most real world problems.
I did have some problems throughout the contest with my choice of C++ -- in fact without Valgrind, my entry may never have run correctly. (Turns out one of my algorithms was "escaping" off the border of the map and scribbling in RAM) But hey, I've been dealing with problems like that for more years than I care to count right now.
:D
http://blog.danielwellman.com/2008/10/real-life-tron-on-an-a...
This was a great walkthrough, and the contest, even though I was nowhere near winning, was a nice learning experience for me.
Favourite line:
I don't have a good formal reason for this, it just seemed intuitively right
For example the expected value of moving up and left should be the same as the the expected value of moving left then up?
That would cut down the search space some. Of course it adds memory overheads.
You could also memoize the voronoi heuristic if that takes a long time to compute.
None. Considered it, but didn't really think it was worthwhile. I was mostly focused on having a good evaluation. I know a lot of my competitors did that, though, but without changing the evaluator it is, as I said, self-deluded.
> For example the expected value of moving up and left should be the same as the the expected value of moving left then up?
That isn't true; that ends up with the wall from the middle move in a different spot.
At any rate, there was a lot I could have done to improve the search speed/depth but I didn't have time, so instead I worked on a better evaluator.
It was pretty interesting -- I would frequently see stronger moves (as best I could tell, after analyzing a losing game) found at shallower levels of search depth discarded in favor of weaker moves at deeper levels. Presumably it assumed the opponent would maximize its Voronoi territory at a time when it was actually a bad thing to do.
Oops yes you are right. They would only be of the same value if the map was symmetrical on the diagonal line going between the first position and the last one.
I wonder it they should be similar (at least in situations where you don't touch walls).
Most of the development was done after putting my son to bed and before collapsing of exhaustion at 3am.