Landing a Spacecraft with Python


pysketch.com

Exploring self-landing strategies for simple lander game.

The most important part of a space trip is being able to safely land the spacecraft at the destination.

Now imagine that you are in a spaceship. Just as you are about to land but the control panel malfunctions. Your only chance is to write an autopilot code from the code screen to land the spacecraft safely.

You can see starting pysketch project below.

When you run the sketch on the output screen the spaceship will accelerate towards Earth and eventually crash. Our goal is to write a function to make the ship land on Earth slowly and safely by only turning on and off engine. But we have limited fuel. We can only turn on engine as much as we need to. Ship starts to fall from a different height every time the project run so we can’t hard code the solution.

If you manage to land the ship safely, you can challenge your friends by sharing this sketch.