Singleton (Java)
From My Limbic Wiki
<SyntaxHighlight_GeSHi lang="Java"> import java.util.*; import java.io.*; import java.math.*;
class Player {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
boolean boostIsAvailable=true;
// game loop
while (true) {
int x = in.nextInt();
int y = in.nextInt();
int nextCheckpointX = in.nextInt(); // x position of the next check point
int nextCheckpointY = in.nextInt(); // y position of the next check point
int nextCheckpointDist = in.nextInt(); // distance to the next checkpoint
int nextCheckpointAngle = in.nextInt(); // angle between your pod orientation and the direction of the next checkpoint
int opponentX = in.nextInt();
int opponentY = in.nextInt();
int thurst = 0;
String power = "";
// Write an action using System.out.println()
// To debug: System.err.println("Debug messages...");
if(nextCheckpointAngle > 90 || nextCheckpointAngle < -90){
thurst = 0;
power = Integer.toString(thurst);
}else if(nextCheckpointDist > 8500 && boostIsAvailable && nextCheckpointAngle < 3 && nextCheckpointAngle > -2){
power = "BOOST";
boostIsAvailable=false;
}else{
thurst = 100;
power = Integer.toString(thurst);
}
//Logs
//System.err.println("Dist: "+nextCheckpointDist);
//System.err.println("Angle: "+nextCheckpointAngle);
//System.err.println("Boost: "+boostIsAvailable);
// You have to output the target position
// followed by the power (0 <= thrust <= 100)
// i.e.: "x y thrust"
System.out.println(nextCheckpointX + " " + nextCheckpointY +" "+ power);
}
}
} </SyntaxHighlight_GeSHi>