The 12th ICFP Programming Contest Award Ceremony and Contest Report

Andy Gill, Garrin Kimmell, Kevin Matlage, Tristan Bull, Nicolas Frisby, Michael Jantz, Ed Komp, Megan Peck, Wesley Peck, Mark Snyder, Brett Werling,

The Information and Telecommunication Technology Center The

September 1, 2009 Good News!

NASA1 were so impressed with the mars rover solution from the 2008 ICFP Programming Contest, they have solicited help in 2009 with cleaning up some wayward satellites in space.

Unfortunately, because of a misunderstanding of last years results, they require the solution to be written in . . . TEX.

After explaining that the solution in TEX was an oversight and not intentional, NASA will accept solutions in any language.

1Not A Space Agency, not to be confused with NASA What is the ICFP Programming Contest?

A true programming contest. Problem is set; solution is required within 3 days. Running for 12 years now. Large – Over 300 teams submitted a solution last year. International – Because solutions are submitted online, teams can work from anywhere. Fun! History of Contest

Pousse Optimize Ray tracer case statements Optimize XML Robots playing a Robots driving a car Sokoban-like game Ant colony Cops & Robbers UMIX Executing DNA Control a mars rover ? What Happened this Year?

Problem statement downloaded over 3000 times. Over 850 teams registered. Over 300 teams submitted a working solution. Forgotten password page accessed over 500 times. Over 8000 individual “solutionlets” submitted and evaluated. Local businesses started reporting lack of productivity on Friday afternoon. Reporter from local paper interviewed team. Requirements of a Good Contest

Wanted to be a real programming contest Solution in any language/environment/os. Wanted to make evaluations of solutions feasible. Wanted to give realtime feedback A leader board, perhaps? Fun, visual problem. Want contest to be for everyone, not just the winners. Avoid domain knowledge advantage. Problem Statement

You are to help program a satellite to clean up the skies of debris. There are three training missions, then Operation Clear Skies. Good luck! First Problem: Hohmann Transfer

The Hohmann problem requires the controller to transfer the satellite, initially in a circular orbit around earth, into a different circular orbit. To successfully complete this task, the satellite must remain in within 1km of the target orbit radius for 900 seconds. Meet and Greet (Problems 2 & 3)

In Meet and Greet, the contestant must move a satellite in a circular orbit about earth to meet with a second satellite, also in a circular orbit. The target satellite will maintain its orbit throughout the simulation.

Eccentric Meet and Greet: This problem generalizes the Meet and Greet problem. The task is still to move the satellite from one orbit to meet with a target satellite. However, the orbits of both satellites can be arbitrary ellipses. Operation Clear Skies

The challenge of the Operation Clear Skies problem is to control the satellite so that it visits a collection of eleven target satellites, each of which are in an elliptical orbit around earth. Because the Operation Clear Skies problem may require a large number of orbit transfer maneuvers, there will be a special refueling station in orbit. Logistics of Moving Satellites in Space

KU supplied 4 “binaries”, one for each problem. We also provided specification of small virtual machine, to run these binaries. Contestants write the VM, and interact with virtual actuators, to fire rockets, and virtual sensors, to detect location in orbit. Contestants upload an audit trail of what actuator fires when. We replay these on our local VM, and validate the score, and update a leader board. At the end of the contest, teams upload their source files. Only looking at top 10, to determine the winners. Our VM

Instruction Semantics Add r1 r2 mem[rd ] ← mem[r1] + mem[r2] Sub r1 r2 mem[rd ] ← mem[r1] - mem[r2] Mult r1 r2 mem[rd ] ← mem[r1] * mem[r2] Div r1 r2 if mem[r2] = 0.0 then mem[rd ]← 0.0 else mem[rd ] ← mem[r1] / mem[r2] Output r1 r2 outport[r1] ← mem[r2] Phi r1 r2 if status = ’1’ then mem[rd ] ←mem[r1] else mem[rd ]←mem[r2] Noop mem[rd ]← mem[rd ] Cmpz imm r1 status← mem[r1] op 0.0 p Sqrt r1 mem[rd ]← mem[r1] Copy r1 mem[rd ] ← mem[r1] Input r1 mem[rd ]← inport[r1] Executing the VM: GOTO Considered Unnecessary

Set up input[...]

Address Value Instruction ...... 80 102.23 Phi 77 78 81 3248.32 Mul 76 80 82 231.23 Div 81 75 83 23.23 Mul 52 82 84 1.0 Div 0 0 85 1.0 Mul 84 84 86 92.23 Div 85 15 87 2142.50 Mul 83 86 88 2389.23 Copy 394 ......

Read from output[...] Our VM in

void step() { for(pc = 0;pc < pcmax;pc++) { switch((insts[pc] & 0xF0000000) >> 28) { case 0: switch((insts[pc] >> 24) & 0xf) { case 0: break; case 1: switch((insts[pc] >> 21) & 0x7) { case 0: mode = regs[insts[pc] & 0x3fff] < 0; break; case 1: mode = regs[insts[pc] & 0x3fff] <= 0; break; case 2: mode = regs[insts[pc] & 0x3fff] == 0; break; case 3: mode = regs[insts[pc] & 0x3fff] >= 0; break; case 4: mode = regs[insts[pc] & 0x3fff] > 0; break; } break; case 2: regs[pc] = sqrt(regs[insts[pc] & 0x3fff]); break; case 3: regs[pc] = regs[insts[pc] & 0x3fff]; break; case 4: regs[pc] = input[insts[pc] & 0x3fff]; break; } break; case 1: regs[pc] = regs[(insts[pc] >> 14) & 0x3fff] + regs[insts[pc] & 0x3fff]; break; case 2: regs[pc] = regs[(insts[pc] >> 14) & 0x3fff] - regs[insts[pc] & 0x3fff]; break; case 3: regs[pc] = regs[(insts[pc] >> 14) & 0x3fff] * regs[insts[pc] & 0x3fff]; break; case 4: regs[pc] = (regs[insts[pc] & 0x3fff] == 0) ? 0 : regs[(insts[pc] >> 14) & 0x3fff] / regs[insts[pc] & 0x3fff]; break; case 5: output[(insts[pc] >> 14) & 0x3fff] = regs[insts[pc] & 0x3fff]; break; case 6: regs[pc] = (mode == 1) ? regs[(insts[pc] >> 14) & 0x3fff] : regs[insts[pc] & 0x3fff]; break; } } } Our Fast VM: Generated C

All instructions always write to the same location.

... r_80 = (code == 0) ? r_77 : r_78; r_81 = r_76 * r_80; r_82 = (r_75 == 0) ? 0 : (r_81 / r_75); r_83 = r_52 * r_82; r_84 = (r_0 == 0) ? 0 : (r_0 / r_0); r_85 = r_84 * r_84; r_86 = (r_15 == 0) ? 0 : (r_85 / r_15); r_87 = r_83 * r_86; r_88 = r_394; ... Interaction: I/O Ports

Input port address Actuator 0x2 ∆Vx 0x3 ∆Vy 0x3E80 Configuration Actuator input ports

Output port address Sensor 0x0 Score 0x1 Fuel Remaining 0x2 sx relative to earth 0x3 sy relative to earth 0x4 Target orbit radius Hohmann Problem sensor output ports Leader Board (with several hours to go) Hints and Clues (from FAQ)

Q. Will there be a teaser this year too that tells something about the contest task in a cryptic way but you can’t really infer anything from it until the task is out, such as the ants image in 2004 or the codex in 2006? A: There already are a number of teasers The Clues

Countdown was in standard NASA format: T-4H00M02S Competition started at 13:00:16 If you google "13:00:16 space shuttle", you can find that the first Mir docking mission docked at June 29, 1995, 13:00:16 UTC. Outside Photo was example of a bad orbit. Guesses about clues

I’ve been wondering if the positions of the organizers in the photo has any significance ? go on... There positions almost suggest 3 6-bit binary numbers

If the english alphabet is zero-indexed, 13:00:16 becomes QAN Sounds like http://en.wikipedia.org/wiki/Koan

stop it, you can’t infer anything about contest fron teasers no, but is still fun hmm, yes :) I bet the organizers are laughing their asses off at our false guesses Our reward for these teasers

5:05 PM, the night before the contest starts. Both ITTC sys admins walk into the lab. Dead pan faces. “We need to rebuild the disk that the ITTC web server is hosted on tomorrow morning, and we are not 100% sure when it will come back online”.

main = do putStrLn "You are joking, right?" putStrLn "No, we’ve detected an anomaly with the disk," putStrLn "and it will fail soon" main Web Site Usage Solving Problems: Best Score Total Number of Problems Solved by How Many Teams Languages Used

32% C 25% C++ 19% Python 17% Java ...... 15% Shell 2 teams Scala 13% Haskell 2 teams PHP 6% ML 1 team Excel 5% Ruby 0 teams T X 5% E 4% Lisp 3% MATLAB ...... Team Names

I C Frantic People Side Effects May Include... Cult of the Bound Variable when i was 4 years old i was maimed by a giant pig Error 404 The Al-Gore-Rhythms The Church of the Least Fixed Point Drunk In Charge of an Orbital Vehicle SpaceGarbageCollector README – Big Sky Problems

Here I don’t even try to compute orbits anymore, just firing my actuators randomly and see if we would get lucky. I waited a few hours for the experiment to run and found that I wasn’t lucky... README – honesty

Run "make" in a directory with the orbital binary files (*.obf) to generate Lisp and Forth input VM configurations. After that, it’s all very interactive and half-assed. README – insanity

This is the implemenation for team OneDayPastDue. OneDayPastDue gets its name from my unborn son, who at the start of the contest was one day past his due date. Many thanks go to my wife who tolerates me staying up almost all night when she could have given birth at any moment. (Incidentally, she went into labor about 2am last night.) README – formulaic

1. Open icfp2k9.sln using visual studio 2008. 2. Press F6. 3. ??? 4. Abandon hope. README – Apology from the lone TEXnician

We originally planned on doing this in postscript. . . Every README needs a unicorn

Languages used: all of them. Trying to build this? Good luck. You need to set up a Mathlab server so the VM can connect to it to solve Lambert. Use "server.m" to run "lambert.m", and configure this connection in lambserv.cpp. None of the other lambert implementations in this repo work properly. We reverse-engineered the binary protocol, sort of. Most of this code came from Livejournal. Solving problems requires using the Haskell stuff. I have no idea how to build this. It will give you output which you can push through xformbert. to get C++ which you can put into the Problem classes. The C++ just builds like C++ but it runs on OSX and uses CoreGraphics to keep it real while thugging out. / .7 \ , // |\.--._/|// /\ ) ) ).’/ /( \ // / /( J‘((_/ \ / ) | _\ / /|) \ eJ L | \ L \ L L / \ J ‘. J L | ) L \/ \ / \ J (\ / _....___ | \ \ \‘‘‘ ,.._.-’ ’’’--...-||\ -. \ \ .’.=.’ ‘ ‘.\ [ Y / / \] J Y/YYL | | | \ | L | | | Y A J | I | /I\ / | \ I \ ( |]/| J \ /._ / -tI/ | L ) / /’------’J ‘’-:. J .’ ,’ ,’ , \ ‘’-.__ \ \ T ,’ ,’ )\ /| ’;’---7 / \| ,’L Y...-’ / _.’ / \ / / J Y | J .’-’ / ,--.( / L | J L -’ .’ / | /\ | J. L J .-;.-/ | \ .’ / J L‘-J L____,.-’‘ | _.-’ | L J L J ‘‘ J | J L | L J | LJL\L\ | L ) _.’\ ) _.’\ L \(’‘ \ (’‘ \ ) _.’\‘-....’ ‘-....’ (’‘ \ ‘-.___/ Prizes Lightning Prize

The lightning prize goes to jabber.ru which means that “ML is the programming tool of choice for rapid prototyping.” Amazingly, jabber.ru won the lightning round last year! Top 10 Teams (before evaluation by judges)

ID Score Team 346 5308.1543 pepsiso 225 5036.7061 THIRTEEN 478 4685.6003 wiiphonies 652 4662.6477 Intercaml 393 4661.6329 when i was 4 years old i was maimed by a giant pig 310 4406.2437 Side Effects May Include... 663 4400.1024 dysfunkycom 122 4176.9931 Cult of the Bound Variable 332 4141.0694 shinh 255 4103.2107 jabber.ru Top 10 Teams : Languages Used

Team Language pepsiso Java THIRTEEN Java wiiphonies C Intercaml C++ . . . giant pig Haskell, MATLAB, C++, PHP, Python, Java. Side Effects May Include... Python dysfunkycom Lisp Cult of the Bound Variable ML shinh C++ jabber.ru ML Judges Prize

The judges prize goes to when i was 4 years old i was maimed by a giant pig Evan Priestley and others from facebook.com which means that “With help, Haskell is the tool of choice for extremely cool hackers.” First Prize

The 1st prize goes to

shinh (Hamaji Shinichiro) which means that “C++ is the programming tool of choice for discriminating hackers.” Next Year: Three Facts

There will be a contest next year. KU will enter a team.

We will have a lot more patience for the organizers! Questions?