So there I was reading the ICFP competition task for this year and I downloaded the ISO image and fired it up under VMWare. Having done that I grabbed one of the simulators and thought it might be fun to just telnet to it and drive the rover around for a bit.
After having done a bit of fiddling around to get the simulator running on my 64 bit Hardy installation I discovered that the simulator crashed when it encountered any whitespace in the command stream. As telnet wouldn't send any data without me hitting enter there was something of an impasse – if I wanted to play around with it I'd have to actually write some code. Oh well.
I kind of wanted to do something in Haskell but the prospect of trying to do all the TCP/IP stuff in a pure functional language didn't really appeal. Python would have been interesting, but it wasn't included and that left me with either learning a whole new programming language or doing it in C++, but without any of my normal C++ tools like Boost. I figured it would probably be good to learn how to do some simple networking stuff on Linux because I'd want that code to port the FOST.3™ TCP streams anyway.
This meant I spent a couple of hours on Saturday and a few more on Sunday knocking up what would be about the simplest thing to do that wouldn't totally suck. In total I think I probably used about eight hours, of which probably three went into working out how to get the network connection open (sending and receiving data was pretty easy once I'd got the connection open) and the rest went into working out a few simple heuristics to get the rover through the three supplied sample maps more often than not.
The things that were trickiest were:
I was expecting the parser for the telemetry and other messages to be quite hard. In the end I just dropped the string into a
std::stringstream and used the extraction operators. Extremely straightforward. I was also a bit miffed that I'd have to write my own smart pointers rather than use the Boost ones, but in the end I didn't use a single memory allocation so it didn't matter.
How do I think it will do? I fully expect the rover to do well enough to get knocked out in the first round of heats.