Matthew Ogilvie's solution:
http://users.adelphia.net/~mmogilvi/mars/