Egér a Marson - ICFP contest 2010


We participated in the ICFP contest (which is my favourite programming contest by far) this year again, the fourth time. This time it was a team of two, H and B, though in practice it was more like 1.5 persons. We ended up at the 14th place, which is not quite bad, given the circumstances. Haskell was the primary language, with upload/download scripts written in Python.

One can read many opinions on the internet (for example, at reddit) saying that this year's contest was quite bad, not worth to spend time on it, etc. While I agree with many of the objections, and I prefer the problems given in 2008 and 2009, I don't think the situations was as bad as some people write. Especially that many of these people really liked the 2006 contest, which seems to me was even more puzzle driven (we participated first in 2007, but I started to solve the 2006 problems once).

About the issues:
About the subproblems:
All in all, the contest was fun, even though it was often quite frustrating, for different reasons. I learned quite a lot from the previous contests; this year's personal take-home message seems to be "understand arrows at last", but I still have to work on that :)

Some details


The ternary encoding can be described as follows (with Haskell-inspired pseudocode):
Stream 
  = List Stream 
  | (Stream , Stream)
  | Nat2

List Stream = (n::Nat1) : Stream^n

(Stream , Stream) = (x::Stream) : (y::Stream)

Nat1 
  = 0 
  | 1 
  | 22 : Nat2
  
Nat2 = (k::Nat1) : Digit^k

Digit = 0 | 1 | 2

Bool = {0,1} :: Nat2

Car  = List (List Nat2 , Bool , List Nat2)
Fuel = List (List (List Nat2))
Maybe it is not the most elegant description out there, but still. The following table may help understanding it:

nNat1Nat2
000
111|0
222|0|1|1
322|1|01|2
422|1|1220|00
522|1|2220|01
622|220|00220|02
722|220|01220|10
822|220|02220|11
922|220|10220|12
1022|220|11220|20
1122|220|12220|21
1222|220|20220|22
1322|220|212210|000
1422|220|222210|001
1522|2210|0002210|002


The scheme for encoding any stream of N trits witd a circuit of approximately 3N/2 gates is also rather nice (and I believe that the bound 3N/2 is optimal for such a general scheme).