Mars Lander - Puzzle discussion

Hi, I realized some realy strange Problem when trying to solve this puzzle (level 1). In the initial step, the X position of the lander was given as 5000 , while the console printed 2500. After the initial step the position was given as delta of the initial position.

Is it supposed to be like this or a bug in the model?

It seems something is wrong with the values read by the program (in C++ at least), I get :

Landing in progress...
X=2500m, Y=2499m, HSpeed=0m/s VSpeed=-3m/s
Fuel=499l, Angle=-5Ā°, Power=1 (1.0m/s2)
Standard Error Stream:
X 0
Y 500
VS 0
HS 0
F 2500
R 2499
P 0
Standard Output Stream:
0 0
3/40
Game information:
Landing in progress...
X=2500m, Y=2494m, HSpeed=0m/s VSpeed=-6m/s
Fuel=499l, Angle=0Ā°, Power=0 (0.0m/s2)
Standard Error Stream:
X -3
Y 499
VS 1
HS -5
F 2500
R 2494
P 0
Standard Output Stream:
5 4

with this code :

    cin >> X >> Y >> HS >> VS >> F >> R >> P; cin.ignore();
    
    cerr << "X " << X << endl;
    cerr << "Y " << Y << endl;
    cerr << "VS " << VS << endl;
    cerr << "HS " << HS << endl;
    cerr << "F " << F << endl;
    cerr << "R " << R << endl;
    cerr << "P " << P << endl;

I also have this problem. Am I missing something?

What is your crashing speed? Is it very close to 40m/s?

I used a method very similar to yours. My solution starts to create thrust around 2200m and landed at vertical speed of 39m/s. It is very possible that there is just this discrete vs continuous model that creates enough numerical errors to ā€œslightlyā€ crash the mars lander.

Hi rdnczn,

i have the same problem with c++;

I changed the ordner in the input line: cin >> VS >> F >> R >> P >> X >> Y >> HS; cin.ignore();

and got the right values. Hope this will help you.

1 Like

For the economic challenge as some of you pointed out, the best way is to put the trust to zero to do a freefall, and then calculate the best moment to put them on at full speed (trust power 4).

AND itā€™s fun to do so :slight_smile:

Finally got level 2 at 100% !

  1. angle which allows not to lose vertical speed is 22 degrees

I have tried with altitude and it goes well

The NASA successfully achieved this puzzle. You should send them a t-shirt (I donā€™t know which language they have used, but Iā€™m pretty sure it is not Bash).

7 Likes

Hey there,

any advice on how to calculate start_X, end_X and Y of the landing area?

Assuming that there will only be one landing area, it should be where two surface points in a row have the same Y coordinate.

while you read the map, store previous Y and then at the next turn check if current Y is the same as the previous Y. If it is the case, then it is the landing area (most propably, if you wanna make sure, try with the next 10 points).

Thanks mate,

I got the perfect spot for landing :slight_smile:

Hello there,

I wonder about landing platform. Thereā€™s everything okay about storing previous Y and checking the current Y, as result, if theyā€™re the same, weā€™ll get end_X, if i get it right. And what about start_X? How can i store it?

If you can store previous Y, same applies for previous X. :wink:

YES! iā€™ve finnaly managed to find measures of landing platform. I didnā€™t catch the essence from the beginning. I was needed a new pair of variables, which will store previous values of X and Y. Then, within ''if" loop with condition: ā€œis previous Y value equals current Y value?ā€, i may set values for start_X, end_X and platform_Y. Itā€™s quite obvious, but i had some kind of smoke in front of my eyes. Feeling myself a little ashamed :smiley:
But hereā€™s a problem. This code works only when landing platform has only 2 points, given by system. If thereā€™ll be more points - code will store the exact end_X position and position left from it will store as ā€œstart_Xā€, but that wonā€™t be correct. Any ideas how to fix this?

Given points are always the minimal set of points to define the surface so landing platform always has only 2 points. You shouldnā€™t seek issues where there are none.

I have another thought. In Mars Lander level 3 we have a cliff, which we have to fly over. How can search for it and store, becides of creating arrays? Because my code doesnā€™t use any arrays. Iā€™m just trying to create a code for every case, though still managing to handle 1st lvl.

Start with defining the point for the lander to land, well in the middle of the landing site.

From there calculate the points where the angle must be 0 and the speed not higher than the maximum speed to be able to land.

Then calculate the path through collision detection until you reach your landers position.

After that keep your lander as close as possible to your calculated path and your algorithm will solve all difficulties :smile:

2 Likes

Damn, well, first step is completed, but how can i calculate points with 0 angle and S < 40? And pathā€¦ have no idea how to do that.