Created
February 2, 2016 21:46
-
-
Save vchatela/874d656332fe382d16a6 to your computer and use it in GitHub Desktop.
Codingame : Mars Lander - Level 1 Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import java.math.*; | |
/** | |
* Auto-generated code below aims at helping you parse | |
* the standard input according to the problem statement. | |
**/ | |
class Player { | |
public static void main(String args[]) { | |
Scanner in = new Scanner(System.in); | |
int surfaceN = in.nextInt(); // the number of points used to draw the surface of Mars. | |
for (int i = 0; i < surfaceN; i++) { | |
int landX = in.nextInt(); // X coordinate of a surface point. (0 to 6999) | |
int landY = in.nextInt(); // 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) { | |
int X = in.nextInt(); | |
int Y = in.nextInt(); | |
int hSpeed = in.nextInt(); // the horizontal speed (in m/s), can be negative. | |
int vSpeed = in.nextInt(); // the vertical speed (in m/s), can be negative. | |
int fuel = in.nextInt(); // the quantity of remaining fuel in liters. | |
int rotate = in.nextInt(); // the rotation angle in degrees (-90 to 90). | |
int power = in.nextInt(); // the thrust power (0 to 4). | |
// Write an action using System.out.println() | |
// To debug: System.err.println("Debug messages..."); | |
if (vSpeed <= -40) { | |
System.out.println("0 4"); | |
} | |
else { | |
System.out.println("0 0"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment