Mars Lander - Puzzle discussion

I think level 1 task has a bad condition like the vSpeed must be from 0 to 40. This is wrong. It must from -40 to 0. Also I’v seen many solutions with changing power from 0 to 4 at once. But condition tells that it can change only for ±1 at once. If you print 0 then you need increase to 4 with 4 steps. Or, perhaps I don’t understand something.

You can print 4 when your thrust is 0. The simulation will accept it, it’ll just raise the thrust by 1 instead of going straight to 4.

You can also have positive vertical speed, it just takes a lot of fuel and doesn’t do you any good for this scenario. In Mars lander 2 and 3, it becomes important.

With GO,

Mars Lander - Episode 2

Inputs order of all tests case are differents each other. Can you please fix the problem ?

what do you mean exactly with “Inputs order of all tests case are differents each other.” ?

    // hSpeed: the horizontal speed (in m/s), can be negative.
    // vSpeed: the vertical speed (in m/s), can be negative.
    // fuel: the quantity of remaining fuel in liters.
    // rotate: the rotation angle in degrees (-90 to 90).
    // power: the thrust power (0 to 4).

    var X, Y, hSpeed, vSpeed, fuel, rotate, power int    
    fmt.Scan(&rotate, &power, &X, &Y, &hSpeed, &vSpeed, &fuel)
    fmt.Fprintf(os.Stderr, "VARIABLES hspeed: %d power: %d x: %d y: %d rotate: %d vspeed: %d fuel: %d\n", hSpeed, power, X, Y, rotate, vSpeed, fuel)

Depending of test case, the input parameters don’t happen in the same order.

Sometimes its hSpeed first (test1), sometimes, it’s power first (test2), and so on…

Is it normal ?

I just check again with original code it seems that is my own code that overwrite the input parameters.

So don’t take care of my precedent message, i will solve this myself, thanks for your time.

1 Like

I haven’t understood the question… please anybody elaborate

the Achievement “Economic” at level 1 needs an update. You need to have at least 3000l of fuel and not 300l like it is stated currently

Misuderstanding or bug in Level 1?

It works fine if I check speed not to increase value of -39. But it conflicts with problem set with “<=40” condition. If I use 40, speed of object takes a value of 41 one step after another. :smirk:

It would be a fencepost error. Or, you’re not counting the increase in velocity between steps, due to gravity.

Just be lazy and add a fudge factor :slight_smile:

1 Like

Hi everyone,

As an exercise, I am trying to minimize my fuel consumption on Episode 1. Currently my best solution has 325L fuel left after landing. Could anyone please tell me if this is the maximum amount? An if not, what is the maximum amount?

I myself am not able to get better than 325L.

I advise you to optimize this one instead: https://www.codingame.com/multiplayer/optimization/mars-lander
Much more variety and you can benchmark yourself against the top AIs.

Agreed, but still curious to know whether 325L is the maximum possible.

Did anyone else do it with at least 300l of remaining fuel and not get the achievement

1 Like

Did you do 300L in test case, or validator (i.e. after you submit your solution and get 100%)? Only validator result counts for the achievement.

Is there a way to exactly calculate the moment when to start using the thrust to land with -40m/s or 0m/s (or as close to 0m/s as possible)? I solved the puzzle but i am not really a fan of the “non-physics” solutions e.g. “if v_speed < XY: …”. Only way i managed was brute forcing (simulating) my way to the exact moment on my local machine - not a really satisfying approach :frowning:

1 Like

Hello , i’ wan’t to solve this puzzle with a genetic algorithm but how i can generate generation ? because when the land crash the game it’s over

1 Like

Did you look into this playground?

https://tech.io/playgrounds/334/genetic-algorithms

1 Like

Yes, I had 309l left

1 Like