Mars Lander - Puzzle discussion

2 Likes

my Godā¦ I use degrees and not radians, what a noobā¦ Thanks 5DN1L

1 Like

Hello everybody,
Iām trying to solve this game with the GA approach, using Java. I know it might not be the best performing language, but itās the only one I knowā¦
I though that representing the land with a TreeMap<Integer, Double>(where the Integer is the x coordinate, and the Double the value of y) could be a good way for rapidly testing if the ship crashed/landed.

if (map.get(ship.x)>ship.y){
return true;
}else return false;

But then I realised that some land shapes are convex, and some x point might need two y points to correctly represent the ground. So I though I could create a TreeMap<Integer, List>, implementing different crashing/landing test methods depending on list size.
Creating 7000 Array List looks a bit weird, and Iām starting thinking there have to be a better way of doing thatā¦

Iāve tried a little bit different approach, but have met exactly the same problem is you. Iāve calculated height when I need to turn on full thrust, but landing speed still was too high. And what Iāve discovered - you are not having full thrust in a moment you print 4 to your output. There are several seconds when engine is warming up till max thrust - and during this time v_speed is still rising for couple of seconds. Which can not be if you could have all the power immidiatelly - v_speed should start to lower, because your acceleration is pointed upwards, not downwards with engines off.

Hi guys.
Do you think it would be possible to solve it with an ACO : Ant colony optimization algorithms - Wikipedia ?
Looks like it could apply

1 Like

Hi, I have a similar problem (C, Mars Lander E2). Did you solve it?

When I run the default code with only this line inserted:

fprintf(stderr, āX:%d, Y:%d, h_speed: %d, v_speed: %d, fuel: %d, rotate: %d, power: %d\nā, X,Y,h_speed,v_speed, fuel, rotate, power);

just below the default line 53:

scanf("%d%d%d%d%d%d%d", &X, &Y, &h_speed, &v_speed, &fuel, &rotate, &power);

The values are almost correct, apart from the value of fuel being truncated to 3 digits. For example 5421 becomes 542.

If I add some more code - code which do not manipulate any of these variables - suddenly the values get scrambled.

Example:

Game information:

Landing in progressā¦ X=5081m, Y=189m, HSpeed=73m/s VSpeed=-67m/s Fuel=337l, Angle=-20Ā°, Power=3 (3.0m/s2)

Standard Error Stream:

X:-20, Y:3, h_speed: 5081, v_speed: 189, fuel: 73, rotate: -67, power: 337

1 Like

they both need to have velocity speed

Hello there,

I canāt seem to unlock the third achievement on the second level even though I manage to land with more than 400L of fuel. How can I unlock it ?

Thanks for the fish

L

Youāve unlocked it.

1 Like

Iām only on level 1, but this is very interesting and the graphical approach was extremely helpful in understanding the purpose and how it all works together. Thank you for this creative exercise!

Everyone out here with physics based solutions to Ep-1 and all I did was loop print (0 3) and print (0 4)

hi I am struggling to see the problem in this code.

`````` if(v_speed < 0)
{
return power = 0;
}
else if(v_speed > 40)
{
return power = 4;
}

cout << rotate << " " << power <<endl;

}
``````

The game information error says : āTimeout: your program did not provide an input in due time. Mars Lander self-destroyed!ā
It is in c++`Preformatted text`

Do you cout something you return ? Is it in main function ?

Assuming what is written above is your actual code and not a collection of cut-pastes from different sections, your code will try to exit whatever function it is in after assigning a value to power. So your output will be whatever power was before it entered this section. Need to get rid of the return statements.

yeah it says in the bottom they present to u some controls u donāt need, cuz its only lvl 1

Problem 1: You prepend assignments with `return`. The statements may still compile (as C/C++ allows some very strange syntax), but the behavior will not be as intended.
Problem 2: Not immediately relevant to the error message, but in the coordinate system specified, `v_speed` will be negative when the lander is falling.

• `hSpeed` and `vSpeed` are the horizontal and vertical speed of Mars Lander (in m/s). These can be negative depending on the direction of Mars Lander.

(Problem 3: The formatting is misleading. The `else if` block should have the same indentation as the `if` block. Also, the code quote posted includes the closing bracket of the loop without including the opening bracket.)

Hi i am at level 2. I am trying to calculate angle between landing point and lander vector. I use theta=Math.Atan2(target.y-lander.y, target.x-lander.x)*180/Math.PI
lander should decrease its tilt when it get close to landin point on horizontal plane but it increases it. There should be some miscalculation. I am not sure if i am calculating the angle between these two points true. Any idea?

Try to print your angle value in error console, and check if it is good or not

How can I know on what height (y coordinate) the landing ground is in level 1?
Do I have to compare 2 sequenced coordinates in the surfaceN loop?

yes. Read the statement : the āhorizontalā part is the landing spot, corresponding to 2 successive points of same altitude. The landing ground altitude is this one.