Mars Lander - Puzzle discussion

ok… but how do you turn on the thruster at exact 2115.7m when we get y value snapshot every 1 second interval?

Hi fellows!
From test 8 to 9, why the v_speed changes from -30 m/s to -33m/s with power = 0. Shouldn’t it be -34m/s?

What do you mean by test 8 to 9? Turn 8 to 9?
I think it is easier if you share the replay link (next to the Settings button in the visual player).

Why did you chose “/5,4”?

Hi guys,
If i try to simulate one case, chosing an angle and thrust, i can’t get the exact next speed and position of the lander. There is always a 1-2m diff in x and y, and a 0-1m/s diff in speed.
My calculation are these :

  • horizontal speed = initial horizontal speed + sin(rotation) x power
  • vertical speed = initial vertical speed + cos (rotation) x power - 3.711
    hence x = initial_x + h_speed
    and y = initial_y + v_speed

any ideas on my problem ? sorry if it has been dealt with before, This thread is looooooooooong

1 Like

Would this help you? https://forum.codingame.com/t/mars-lander-fuel-puzzle-discussion/685/18

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) :skull:

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