Day 3 of my 100 days of code in 2017 was spent on the Mars Lander problem at CodinGame.
And I am not finished because geometry and distances / speed is not my strength but I have written a basic steering algorithm to start. Code is not public because it is not working currently and I encourage you to solve the tasks by yourself.
My approach is the following:
- find the landing surface
- decide if the lander is moving toward the surface
- keep the lander as high as required along the way
- slow down the horizontal speed to match the requirements
- slow down the vertical speed to match the requirements
- calculate a good angle for steering (moving toward landing or slowing down)
- calculate the right horizontal speed to keep lander inside the surface until landing
The idea seems good enough, not I only have to code it. The first part is done, I struggle with the angle and the speed — basically with the core of the application. Beside this I’m thinking about some simulation and AI. It would be a good start to get going and prepare for the challenges.
And I did Day 5 of Advent of Code 2016. It was simple MD5 calculation with some twists. The most problematic in part two was to find the right values. It was not enough to accept numbers 0-7 from the hashes but to get the right one if more of the same index occur. However after finding the right code the solution was easy to find too.
I think AoC stops until this weekend, I will concentrate on CodinGame challenges instead.