Sponsoring the Code War was a total blast. I think everyone there had a really good time. Everyone definitely put everything they had into it with 8 super-intense hours of design and coding. And everyone created a good A.I. We will definitely do this again next year.
Which leads to the question, is a gaming A.I. a good problem for a code war? Even for a simple game this is a task that normally will take 1 – 3 programmers weeks to months. On the flip side, it is possible to create an A.I. that is competent in a day. Poor compared to a 2 month effort, but still superior to random moves.
But let's step back and look at the purpose of the games. Google's Code Jam is designed to find them the best programmers for writing the fastest server code. And that serves them well for finding people that can further optimize their code that servers billions of requests a day. Microsoft's Imagine Cup is designed to get people to create useful applications using Microsoft products. And that serves them well exposing more people to the Microsoft suite of development tools. HP's Code Wars is for High School students and is designed to provide a fun event for the students.
For Windward we have two sets of goals with the code wars. My personal goal is to create a fun event for the students who love programming. I also want to give incoming students an event where they can get to know the others in the C.S. department (when I started as a freshman at C.U. I knew no one and it was a bit lonely at first). And I like creating a competition where people are celebrated for their brain power rather than their athletic skills.
Now to sell it to my company (this costs about 1K to put on and takes about a week of my time), we have the company goals. Those goals are to contribute to the community, be the #1 choice for internships, and for participants to remember Windward and consider us when they need reporting, docgen, or B.I. software.
So based on what I want to accomplish from this, I want the contest to be intellectually challenging, push the participants to their limits (and a bit beyond), and give them a sense of well-deserved accomplishment at the end. But I don't care what the code in particular does. Nor do I care about the operating system or language. Because we're not trying to measure any particular skill nor promote any particular environment or products.
I do think a game is also fun because instead of the result being a score for each team with the high score winning, instead you watch robots move on the board and shoot each other as you are following your robot cheering for it when it makes a good move. The play-off is a lot more interesting.
So please comment below with your opinion as to what type of problem(s) we should present and any other suggestions for next time.
Future Code War Environment
The next time we are going to set it up where we talk to each entry over TCP/IP where we pass a problem across in an XML file and get the solution back in an XML file. This will make it easy to write a solution in any language on any operating system. Half the contestants were using IronPython and VisualStudio was missing basics like code complete for python (yuck!). (With that said, the best two entries were written in Python so it wasn't too bad of an environment.) But if it's a simple XML file sent across the wire, then each team can use any environment they wish and will have the tools they know the best.
Next Code War Contest
There absolutely will be another contest at C.U. at the start of next Fall's semester. So for those of you at C.U. who participated, tell your friends.
But I also have a request from my youngest daughter who goes to Harvey Mudd to sponsor a Code War there at the start of this Spring semester. So I am going to contact Mudd, CalTech, and MIT and see if they are interested in having a group competition this upcoming January.
Thank You
And finally a thank you to Professor Ken Anderson who made this happen at the C.U. end and spent his Saturday at the event. And thank you to all the students who participated – you all made it well worth the time I put in on this in how much you enjoyed it.


I for one had a lot of fun, so many thanks to you for putting on the code war. I was curious if perhaps you could have a second category of code war next year: the previous year's game. That way students have a nice API to attempt a more complex AI with. While not as level a playing field, since people have varied schedules, it need not be anything more than the competition phase while people eat. I know I for one programmed a generic alpha-beta search and genetic algorithm (which I didn't have time to implement during the actual code war, but would have loved to try and use). Thanks again for a fun day!
Posted by: Phillip | 08/31/2011 at 12:55 PM
First, my team and I had a great time, and I enjoyed both the competition and meeting people (I'm a new grad student so this was great).
Second, I've gotten our code posted (with a few comments about what we did and why):
nick-goodman.blogspot.com/2011/08/code-war.html
Third, I believe that there are some areas that can be improved (David's post hits these pretty well, I believe):
1) The code war did not really allow for effective Java development.
- Java 1.2 was released in December of 1998, so it's not true to claim that it's the equivalent to using the latest .NET that VS 2010 supports. Java 1.2 doesn't include things that Java developers leverage to improve coding effectivness (auto boxing, generics, enums). Moreover, the Java supported by Visual Studio is a Microsoft variant: J#.
- The biggest limitation was in the tools available. Because we were forced to use Eclipse to edit (because the VS tools couldn't edit the .jsl files), VS 2005 to compile, and VS 2010 to build, our productivity was diminished by between 40% and 60%. I believe our algorithm would have been significantly better if we had been able to spend more time on it instead of spending time digging through non-issues related to the build and to the C# code. This was also due to the "Java" files being .jsl files, which can't be compiled by a Java compiler (only by the J# compiler).
- Moreover, never having used Visual Studio, we were unable to use advanced object reference techniques that are built into Eclipse to dig into code to figure out things like where the repair squares were. We discovered (and David confirmed) that Java and Python developers couldn't access the repair squares because of the C# to other language conversion of enums.
- I suggest that future code wars that need to run in a .NET environment provide an ant build file that creates a .dll file from Java.
2) The computer AI should probably not be provided. This may be an oversimplification, but it appears that the winning team basically increased the iteration count (by a few orders of magnitude) that the computer AI executed. Thus, we were really competing against the original AI, not eachother. Our team implemented entirely new logic. I believe we held our own against all teams except the winning one. I do not believe that what they did was cheating or unfair; however, in future competitions, it would be more fun if all teams were required to implement their on AI.
Posted by: Nick Goodman | 09/01/2011 at 09:41 PM
I had a great time with Code Wars. I've always wanted to do something like that. Thank you to all of the people (especially David Thielen and Professor Anderson) for organizing all of this.
Our team implemented three different strategies: aggressive, "least damage", and "flag-finding". The aggressive strategy would just use cards that had high priority. The "least damage" strategy would try to move in a way that would minimize the damage taken during a turn. The "flag-finding" algorithm is pretty self-explanatory. Each turn we would weight our choice based on our current health. In theory, it sounded like a good strategy, but in practice it didn't pan out as well as we had hoped.
Originally, our team started out using Python because we were all fairly familiar with it. However, it was just easier to use C# since the original code base was in C#. By using C#, code auto-complete came quite easily in Visual Studio. Overall, it worked out pretty well since C# is pretty straight-forward to pick up.
My biggest suggestion would be to run the simulated competition hundreds of times so that it would be more clear where each team placed.
Posted by: Ryan Kroiss | 09/02/2011 at 10:15 AM
Overall the Code War was a great experience. It was the first time I had participated in an event like that and I'm very glad I did it.
I thought that the game had too much randomness though. Programming an AI for it was very hard and ended up being more of a random move strategy anyways. I think more constraints would have made it more interesting.
Posted by: Brian | 09/03/2011 at 02:24 PM