July 14, 2008
ICFP 2008 After 10 Hours
The 10 Hours have passed. The result is an unfinished C++ implementation of a rover. In fact, all I did in the 10 hours was the supporting framework for the rover.
Its features are:
- Connection to server;
- Parsing of messages from server;
- Wrapper for sending well-formed messages to server;
- Messages are converted into world objects that can be added to world state;
- Launches two threads, one to receive messages from server and another one to control the server based on the current state continuously modified by the first thread;
An hourly update is as follows:
- Reading of problem description and implemention of the socket for server connection;
- Message Keeping structures;
- Decision about initial rover strategy (described later on) and implementation of threads;
- Finished handling threads;
- Creation of world object structures;
- Parsing of messages into object structures;
- Finished parsing messages into object structures;
- Starting implementation of state-based strategy;
- Reverting implementation into a stateless strategy;
- Initial implementation of a stateless strategy;
The strategy which initially I thought I had time to implement based on state would require the implementation of a QuadTree structure and some path-finding algorithms also in order to reuse information used in previous turns. As the time was not enough I reverted into a simple stateless strategy where the rover purely reacted to its vision environment:
- Can I see a Martian? If yes, run like hell AWAY from them.
- Do I see a Boulder or Crater in path? If yes, then turn to the best side depending on obstacle position.
- Is homebase in current path? If no, then turn to the best side in order to have homebase in path as soon as possible.
This was ultimately the strategy I decided to follow and still no time was enough. Although sad that I couldn’t dedicate the whole weekend to it I still did a few things and had loads of fun. The implementation was all git-kept and a tarballed for future reference. (if for some reason you cannot access the tarball, let me know).