Poll HN: What language for a programming competition?
For a programming competition most comparable to MIT's 6.370 that would draw from a large base of programmers, both hard core professionals and amateurs, what programming language would be most accessible for people?
The goal would be to not scare anyone away from the competition and actively encourage non/infrequent programmers to participate. At the same time, we would want the language to offer flexibility to the competitors in their approaches and styles.
Please comment on your choice and what aspects of the language influenced your decision.
EDIT: For clarification, this contest would be most directly comparable to MIT's Battlecode (6.370) http://battlecode.mit.edu/2010/info. This competition involves programming the AI for robots in a simplified RTS game. However, there's no reason why we would necesarily have to build it on the java JVM.
20 comments
[ 3.0 ms ] story [ 64.6 ms ] threadIf anyone has good ways of doing this across programming languages/across machines, please let me know, but something like 6.370's approach (fixed number of bytecodes per turn) seems like the most reasonable and fair.
As you mentioned, using bytecodes to measure computation time is a good approach since it results in deterministic gameplay -- and that's one of the reasons 6.370 stuck with Java for so long. A nice corollary to this approach is that if you can instrument the contestants' bytecodes, you can easily run your game engine alongside contestant code in the same VM, which is a pretty clean and fast architecture. And of course that still allows for JIT compilation if you really care about speed.
As for the programming language, I'd cast a vote for Python, since it shouldn't be too hard to instrument [I've never tried] and contestants will be happier coding in a more productive language. If you want to keep Java around, I believe Jython compiles Python source to Java bytecode, under the hood. Java contestants would have a home turf advantage, but perhaps the Python language is worth it? I don't know anything off the top of my head about compiling Java source to Python bytecode, but I imagine that situation would put Java at a heavy disadvantage.
Of course, any bytecode will work, so if you're considering going multi-lingual an obvious suggestion would be the .NET CIL which nets you all languages in the .NET framework. But my impression, at least from my time at MIT, is that contestants would be less happy with .NET.
You could also just instrument machine code. Piece of cake right?
We used templates to create the game stuff. Unfortunately, it's not quite a stand-alone library, but hopefully someone else can use it.
If it's about design, then look at your audience... there's not that much of a difference between python and java - just choose one. Although with java you'll get loads more boilerplate code which might be tedious to look through.
If you can avoid limiting which languages are allowed, do so. If you need to provide some sort of library, would XML-RPC work for it? You could easily write a client for a large number of languages.
Or, since it's for robots, why not consider a new minimalist language specifically for the competition. That way it's more about strategy instead of solving programming problems. It's tailored specifically to robot capabilities with nothing to distract or confuse.
If you restrict it to a specific language then the judging will be skewed towards "how well do you know language X" instead of "how well can you translate the problem into data+algorithms." However, allowing multiple languages might bias the competition into a language rather than a programmer contest. PG has said (somewhere, can't find the ref) that one reason they were able to implement ViaWeb as well and quickly as they did was the language choice - Lisp.
The logistics of supporting multiple languages might constrain that decision, of course, but a well-designed API might be more language-agnostic.
On the other hand, if you are interested in leveling the playing field and removing rote skills, you might consider specifying a language with which the teams are unfamiliar such as go, erlang, clojure, or the like. That will tend to force the programming team to think about what they are trying to accomplish in abstract, conceptual terms rather than just hacking.