The first coding competition of the year happened on January the 25th. We wanted to offer you a very special journey to… Mars.

Why Mars? Because 10 years ago, on January 25, 2004, NASA’s Opportunity rover landed on the Red Plane. She has been at work ever since, rolling its way far beyond its expected lifetime (that initially was of 90 days)! Having traveled a total of 24.05 miles (maxing out at 50 millimeters per second; the tireless rover drives between 160 to 320 feet each day), Opportunity broke through a new space driving record.

Such a performance called for a celebration, so we packed cool prizes and imagined a new type of puzzle.

Your mission for this coding contest was to land the module containing Opportunity and disembark the rover safe and sound on the Martian floor in increasingly complex configurations. The approach to the problem could be a little puzzling, we admit, compared to the exercises that we usually present, and with a higher degree of difficulty. In the end, in light of the results, it seems that this challenge won the day hands down.

3 Coding Exercises of Increasing Difficulty

Mars Lander – Level 1

“What if there is a hostile form of life on Mars? I didn’t bring my BB gun. :S”

Ammar_

For this first coding challenge, we left the traditional algorithmic question behind to immerse you in a NASA-type landing simulator. To start smoothly, it was necessary to proceed with a simple vertical landing.

Prerequisite: detect the floor to touch down without mishap (and not like a klutz, falling in a heap). A few judiciously directed upward thrusts sufficed to avoid dismally crashing Opportunity.

Mars Lander – Level 2

“After a lot of efforts, I can pass 4 test cases for question 2. Watching the lander find its path is just amazing.”

obourgain

Here it gets more complicated: the trouble was to find the landing zone, to not descend too much and to take it easy with the gas power to manage the fuel gauge (at risk of miserably crashing anew in a heap).

Land the rover on a flat surface

Despite everything, it wasn’t obvious to also manage the speed of approach, the rotation for leaving on the correct side, to take off again… But in the end, there was no need to find a route with respect to the ground (even if it was necessary to land in a flat area).

Mars Lander – Level 3

“I just screwed.
Damnit!”

skypers

As everyone knows, there are caves on Mars (yes, yes!) and this eventuality had to be taken into account by the brilliant engineers of NASA (of whom you are a part). Ultimate problem: this time there were obstacles. Thus, a makeshift job could not do. It was necessary to break out some math and a touch of physics to detect the walls and calculate the trajectory of the vessel in advance.

Landing the rover in a cave

The real algorithmic element came down to applying the methods of pathfinding –– an extremely arduous task that gives all the more reason to congratulate those who made it!

Hardcoding Couldn’t Work

For the 2nd and 3rd problems, it wasn’t possible to trace a predefined path for Opportunity. Indeed, let it be repeated, the validators are in the end always different than the use cases given in the statements.

Warning: neither are we looking to trap you. The validators are consistently very close to the proposed tests (here the difference is a close shave of only a few meters downwards).

The Final Ranking

Congratulations to pulse, kangz and where-is-s who were the first to achieve 100%, in C#, Python 3 and C++ respectively.

You can find the complete leaderboard here.

As promised, the top 10 globally ranked participants win a CodinGame t-shirt, as well as the first finishers in the ranking by language who have a score greater than or equal to 50%.

For the first time among the top 10 participants, Python 3 and Haskell are represented!

Among the 1,524 registered, 963 participants made it to the end of the Mars Lander adventure. The entrants come from 56 different countries. In the Top 10 of most represented countries: France, India, Morocco, Russia, Tunisia, Ukraine, Brazil, USA, Romania, UK.

Results of the coding competition Mission to Mars

Final Words of Love from Participants

“It was the most fun I had in decades. Thank you guys for making this possible.”

Ammar_

“Congratulations on you guys and thank you 🙂 good luck on the follow-up of the challenge ^^”

VonRickRoll (admin)

“It would be interesting to show ranking by fuel usage… my remaining fuel for question 1: 3021. Anyone better?”

dolmen

“I would like to say I really enjoyed the challenge. I participated for fun and fun is what I had.”

bolemeus

#59 in a monthly programming challenge; tweet

fun challenge; tweet


Solve Mars Lander - Level 2