-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mars lander.txt
37 lines (33 loc) · 1.63 KB
/
Mars lander.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
var surfaceN = parseInt(readline()); // the number of points used to draw the surface of Mars.
for (var i = 0; i < surfaceN; i++) {
var inputs = readline().split(' ');
var landX = parseInt(inputs[0]); // X coordinate of a surface point. (0 to 6999)
var landY = parseInt(inputs[1]); // Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
}
// game loop
while (true) {
var inputs = readline().split(' ');
var X = parseInt(inputs[0]);
var Y = parseInt(inputs[1]);
var hSpeed = parseInt(inputs[2]); // the horizontal speed (in m/s), can be negative.
var vSpeed = parseInt(inputs[3]); // the vertical speed (in m/s), can be negative.
var fuel = parseInt(inputs[4]); // the quantity of remaining fuel in liters.
var rotate = parseInt(inputs[5]); // the rotation angle in degrees (-90 to 90).
var power = parseInt(inputs[6]); // the thrust power (0 to 4).
// Write an action using print()
// To debug: printErr('Debug messages...');
//Vérification de la vitesse verticale pour qu'elle ne dépasse pas 40 en valeur absolue
//d'ou il faut effectuer la comparaison par rapport à -40 et non pas 40.
//si la vitesse est atteinte est supérieur à 40 il faut augmenter le power pour ralentir l'atterrissage sinon laisser la capsule chuter normalement.
if(vSpeed <= -40){
print('0 4');
//printErr(vSpeed+":"+hSpeed);
}else{
print('0 2');
//printErr(vSpeed+":"+hSpeed);
}
}