Interstellar Contest on Fuun Programming 2007 (Endo Lives)
Preliminary
On July 20–23, 2007 we participated at the ICFP Programming Contest. The contest task was to repair the genetic material of an alien called Endo. He has a special genetic structure consisting of the bases I,C,F, and P, which encodes a programming language based on regular expressions. The output of this process, the RNA, consisted of drawing primitives, that allowed the generation of an image displaying Endo's shape. The goal was to change Endo's genes by adding a prefix in front of it, that should modify the process to produce a different image where Endo lives happily in the shape of a cow.
My experience from the contest is given here. I later spent much more time to find a perfect prefix that would restore the target image completely. For this I developed a faster DNA converter in Java (see below), a disassembler, and heavily improved the perl script that writes the prefix. My best prefixes are collected here.
Fuun DNA/RNA Interpreter in Java
After the contest I wrote a new DNA/RNA Interpreter in Java (we used an ocaml version during the contest). The goal was to get a competitive interpreter that also displays the processed RNA (the picture) on the fly. I chose Java as language because it is portable, makes it easy to output graphics and is pretty fast thanks to its JIT compilation technique.
You can download endomorphose, my Fuun DNA/RNA interpreter written in Java. It needs Java 5 (version 1.5) or higher. It is competitive, doing more than 200,000 iterations per second on a 3 GHz CPU. It can produce the source image in less than 10 seconds if GUI is turned off. The term ‘graphical user interface’ is a bit exaggerated. It just displays the picture and you cannot interact with it. Use my tool as follows:
- To create an image and show it, on most operating systems it is enough
to double click the downloaded file. If you prefer the command line, use
java -jar endomorphose.jar
It will use a file calledprefix.dna
as prefix if it is placed in the same directory. The resulting image will be saved asout.ppm
. - You can download one of my perfect prefixes to produce the target image. You need to unzip the prefix.
- To benchmark the tool use the switch
-nogui
:time java -jar endomorphose.jar -nogui
The image is still produced and written toout.ppm
. - To show the executed commands use the switch
-v
:java -jar endomorphose.jar -v
If you also want to see the matched patterns, give the switch twice:java -jar endomorphose.jar -v -v
- To get the source code use:
jar -xf endomorphose.jar