Work Locally, Compete Globally
Up until now, for most competitions, you have local competitions, often spread out over several weekends. And then the winners of those competitions fly to meet for the national competition. But there's no reason to do this for a programming contest. And there are some very good reasons to run the entire event in 1 day with everyone competing from their school. Just as programming teams can be composed of people all over the globe, so can competitions be among contestants all over the globe.
With the entire event in 1 day, we only have to create a single problem for the contest. This year for The Windward National Intercollegiate Programming Competition it is writing the A.I. for a computer game. If the contest was spread out, we would have to create a different game/A.I. challenge for each day. And creating each game is a lot of work (figure about 4 man/weeks go into each game for programming and testing).
This also reduces the time commitment for each student participating. It is 8 hours once to create the A.I. and then running that A.I. later in the day for the national play-offs if they win the contest at their school. That's it. No multiple days of programming as they advance each round. No flying on a plane with the additional time required. It's all in one day, yet they go all the way to the national contest in that one day.
The Internet is your friend
So what are the mechanics behind it? The game uses a client/server model where the game is run on the server and each A.I. is a client. The original reason for this model was to support the A.I. being written in any computer language so each team can use the language they are most comfortable with (we created examples using C#, C++, Java, & Python). When we decided to run the contest across all the top Computer Science schools, this model made the approach workable.
The client/server communication is over TCP. The client creates a connection with the server to join the game. The server then sends requests as XML packets to the client and the client replies with its turn as an XML packet. The server sends a turn request to all clients, then waits N seconds (2 for local games, 6 for the national) for a response. If a response does not occur within the allowed time, then the server creates a random turn for that player for that turn.
The clients are given 1 second to determine each turn. The additional time is to allow for the delay in sending a message over the net, to the client and then the return. The server is totally asynchronous using an event timer to run a turn and receiving incoming messages as events. However the sample clients are written to respond to an incoming message by determining their move and replying in the thread that receives the message. This is the most efficient way to do this -- if the A.I. always computes a turn in under a second.
The system is also set up at both ends to automatically restore a connection if the connection is dropped. At worse a dropped connection will mean that client has 1 turn randomly created by the server. We tested the system thoroughly and it works great.
The initial rounds are played at each school. The game takes up to 12 (number may change) A.I.s at once. It plays the game 10 times keeping a total of each A.I.s score across the games. If a school has over 12 teams, they can have multiple playoffs and then have the top 2 from each round play for the school championship.
We then take the top 2 teams from each school (and the top scoring 3rd place teams as needed to fill up to 12 A.I.s per round) and then do the same thing for the national championship.
The Future for Competitions
There's no reason to go through the additional time and inconvenience in spreading national competitions of this type over weeks and flying people to the same physical location. As time goes on more and more will switch to this decentralized approach because it works better for all involved. This also opens up competitions of this type to everyone, because location doesn't matter. For The Windward National Intercollegiate Programming Finals (All the excitement of March Madness, without the sweat!), if it works well this year, then next year we will open it up to all schools -- worldwide (which will make it the "worldwide" instead of "national").