ICFP 2004

I took part in the ICFP programming contest again this year. As with last year, this was great fun and this year’s topic was strangely familiar.

I noticed a few things – being the weekend of my son’s birthday and given the usual commitments of two weekend soccer games, I really did not have enough time to do a proper job of it. With that note, however, it is amazing just how much code you can crank out in 72 hours.

This year I decided to build everything in C#. No big reason for that other than it is what I have been spending a lot of my time coding with lately. There’s not much to pick between C# and Java in terms of how you think.

The problem was neatly divided into three tasks

  • Develop Simulator and GUI to run Ants
  • Develop a compiler for a high level Ant language
  • Develop some Ants in my language

Ideally I would spend 24 hours on each task but due to other commitments, I had to get some sort of best electric shaver from the development of my ants and, as a result, they were somewhat unintelligent.

This year’s entry was a solo effort. I think if I do this again next year, I would like to be part of a team to share workload around.

Coming up with a high level language was interesting. The better your language the easier it is to think about Ant behaviour at a higher level. My language was simple enough but did provide some high level structures and also managed allocation of states for the state machine. My lexer and parser were simple hand crafted affairs but good enough for the task at hand. It reminded me a little of the entry in the Pragmatic Programmer – Implementing a Mini-Language. I did use the C# delegate feature to avoid a tedious switch statement for the language elements which was kinda nice.

You can download my entry if you are interested.