Here is a little coding exercise inspired from one of the codeingame puzzels. It was ported based on the Mars Lander-2 game made by mrswanson. This game is primarily targeted as a coding exercise for kids/students to learn programming.
Your mission: reprogram the mars lander.
In fact the problems concerns the landing phase for “Mars Lander”, the landing ship which contains the Opportunity rover. Mars Lander is guided by a program, and right now the failure rate for landing on the NASA simulator is unacceptable.
Built as a game, the simulator puts Mars Lander on a limited zone of Mars sky. The zone is 138m wide, the center of his position is at position “LanderX”. The ship can get into the zone at a variable location but may not crash on the mountains.
Your mission is to write a new artificial intelligence program that will enable Mars Lander to land safely on Mars without crashing. The program will have to go through a series of increasingly complex simulator tests.
You’ll find the Mars Lander program under:
– You should add your code inside the lander forever loop.
Click on the lander sprite, in the “Scripts” tab you should see:
– To drive the lander you should broadcast “left”, “right” or “up” messages.
For a landing to be successful, the ship must:
– land inside the flat ground, the center of the landing path is at horizontal coordinate 0 (when x = 0). (=LanderX)
– vertical speed (=ymotion) must be limited ( ≤ 1 m/s).
– horizontal speed (=xmotion) must be limited ( ≤ 1 m/s).