After 200 days of traveling space and eating cereals you finally reach Mars. Time to land at last!
The lander is on autopilot and all you have to do is look around and tell it
where to land. The lander must land on a flat zone it you want to remain
in one piece. You indicate the lander where to land by modifying the
getLandingZone
function so that it returns a
[!java|scala]Segment
representing the zone of your choice.
A segment is composed of two Point
s, each of them composed of
two double
s. A segment is built via the
Segment([!java]Point [/!]start[!scala]:Point[/!], [!java]Point [/!]end[!scala]:Point[/!])
constructor.
A point is built via the Point([!java]double [/!]x[!scala]:Double[/!], [!java]double [/!]y[!scala]:Double[/!])
constructor. A point's coordinates are accessible via its
[!java]double [/!]x()[!scala]:Double[/!]
and
[!java]double [/!]y()[!scala]:Double[/!]
methods.
In order to determine which zone to return, you'll need to call
[!java]List<Point> [/!]getGround()[!scala]List[Point][/!]
, which returns
the vertices of the ground's profile as a list of
[!java|scala]Point
[/!] [!python]tuples (x,y)[/!].
One more thing: your function should return a valid flat zone in any kind of situation, not just for the currently visualized one. That's because it will be not only tested against that world, but also against the one we had in the previous exercise. As usual, you can see the other existing worlds with the appropriate combobox.
Have a safe landing! Don't forget to put on your space suit on your way out.