最終日に2時間ほど参加して、一瞬参加したというchokudaiさんに勝ててよかった。


Rank 985/2512


Approach レイジが60以上の時5%の確率でスキルを使う。
それ以外は、Nearest Neighbor。



source code

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);

// game loop
while (true) {
int myScore = in.nextInt();
int enemyScore1 = in.nextInt();
int enemyScore2 = in.nextInt();

int myRage = in.nextInt();
int enemyRage1 = in.nextInt();
int enemyRage2 = in.nextInt();

int unitCount = in.nextInt();

ArrayList<Reaper> reapers = new ArrayList<>();
ArrayList<Destroyer> destroyers = new ArrayList<>();
ArrayList<Doof> doofs = new ArrayList<>();
ArrayList<Tanker> tankers = new ArrayList<>();
ArrayList<Wreck> wrecks = new ArrayList<>();
for (int i = 0; i < unitCount; i++) {
int unitId = in.nextInt();
int unitType = in.nextInt();
int player = in.nextInt();
float mass = in.nextFloat();
int radius = in.nextInt();
int x = in.nextInt();
int y = in.nextInt();
int vx = in.nextInt();
int vy = in.nextInt();
int extra = in.nextInt();
int extra2 = in.nextInt();

if (unitType == 0) {
Reaper reaper = new Reaper();
reaper.unitId = unitId;
reaper.unitType = unitType;
reaper.player = player;
reaper.mass = mass;
reaper.radius = radius;

reaper.x = x;
reaper.y = y;
reaper.vx = vx;
reaper.vy = vy;
reaper.extra = extra;
reaper.extra2 = extra2;
reapers.add(reaper);
} else if (unitType == 1) {
Destroyer destroyer = new Destroyer();
destroyer.unitId = unitId;
destroyer.unitType = unitType;
destroyer.player = player;
destroyer.mass = mass;
destroyer.radius = radius;

destroyer.x = x;
destroyer.y = y;
destroyer.vx = vx;
destroyer.vy = vy;
destroyer.extra = extra;
destroyer.extra2 = extra2;
destroyers.add(destroyer);
} else if (unitType == 2) {
Doof doof = new Doof();
doof.unitId = unitId;
doof.unitType = unitType;
doof.player = player;
doof.mass = mass;
doof.radius = radius;

doof.x = x;
doof.y = y;
doof.vx = vx;
doof.vy = vy;
doof.extra = extra;
doof.extra2 = extra2;
doofs.add(doof);
} else if (unitType == 3) {
Tanker tanker = new Tanker();
tanker.unitId = unitId;
tanker.unitType = unitType;
tanker.player = player;
tanker.mass = mass;
tanker.radius = radius;

tanker.x = x;
tanker.y = y;
tanker.vx = vx;
tanker.vy = vy;
tanker.extra = extra;
tanker.extra2 = extra2;
tankers.add(tanker);
} else if (unitType == 4) {
Wreck wreck = new Wreck();
wreck.unitId = unitId;
wreck.unitType = unitType;
wreck.player = player;
wreck.mass = mass;
wreck.radius = radius;

wreck.x = x;
wreck.y = y;
wreck.vx = vx;
wreck.vy = vy;
wreck.extra = extra;
wreck.extra2 = extra2;
wrecks.add(wreck);
}
}

// Write an action using System.out.println()
// To debug: System.err.println("Debug messages...");

String reaperCommand = "WAIT";
String destroyerCommand = "WAIT";
String doofCommand = "WAIT";

Tanker minDistanceTanker = null;
for (Destroyer destroyer : destroyers) {
if (destroyer.player == 0) {
double minDistance = 1e9;
for (Tanker tanker : tankers) {
// int dy = destroyer.y - tanker.y;
// int dx = destroyer.x - tanker.x;
int dy = 0 - tanker.y;
int dx = 0 - tanker.x;
double distance = Math.sqrt(dx * dx + dy * dy);
if (distance < minDistance) {
minDistance = distance;
minDistanceTanker = tanker;
}
}
if (minDistanceTanker == null) {
continue;
}
if (myRage >= 60 && Math.random() < 0.05) {
destroyerCommand = ("SKILL " + minDistanceTanker.x + " " + minDistanceTanker.y);
} else {
destroyerCommand = ("" + minDistanceTanker.x + " " + minDistanceTanker.y + " " + 300);
}
}
}

for (Doof doof : doofs) {
if (doof.player == 0) {
double minDistance = 1e9;
Reaper minDistanceReaper = null;
for (Reaper reaper : reapers) {
if (reaper.player == 0) {
continue;
}
int dy = doof.y - reaper.y;
int dx = doof.x - reaper.x;
double distance = Math.sqrt(dx * dx + dy * dy);
if (distance < minDistance) {
minDistance = distance;
minDistanceReaper = reaper;
}
}
if (minDistanceReaper == null) {
continue;
}
if (myRage >= 60 && Math.random() < 0.05) {
doofCommand = ("SKILL " + minDistanceReaper.x + " " + minDistanceReaper.y);
} else {
doofCommand = ("" + minDistanceReaper.x + " " + minDistanceReaper.y + " " + 300);
}
// Tanker minDistanceTanker = null;
// for (Tanker tanker : tankers) {
// int dy = doof.y - tanker.y;
// int dx = doof.x - tanker.x;
// double distance = Math.sqrt(dx * dx + dy * dy);
// if (distance < minDistance) {
// minDistance = distance;
// minDistanceTanker = tanker;
// }
// }
// if (minDistanceTanker == null) {
// continue;
// }
// System.out.println("" + minDistanceTanker.x + " " + minDistanceTanker.y + " " + 300);
}
}

for (Reaper reaper : reapers) {
if (reaper.player == 0) {
double minDistance = 1e9;
Wreck minDistanceWreck = null;
for (Wreck wreck : wrecks) {
int dy = reaper.y - wreck.y;
int dx = reaper.x - wreck.x;
double distance = Math.sqrt(dx * dx + dy * dy);
if (distance < minDistance) {
minDistance = distance;
minDistanceWreck = wreck;
}
}
if (minDistanceWreck == null) {
if (minDistanceTanker == null) {
continue;
}
if (myRage >= 60 && Math.random() < 0.05) {
reaperCommand = ("SKILL " + minDistanceTanker.x + " " + minDistanceTanker.y);
} else {
reaperCommand = ("" + minDistanceTanker.x + " " + minDistanceTanker.y + " " + 300);
}
continue;
}
if (myRage >= 60 && Math.random() < 0.05) {
reaperCommand = ("SKILL " + minDistanceWreck.x + " " + minDistanceWreck.y);
} else {
reaperCommand = ("" + minDistanceWreck.x + " " + minDistanceWreck.y + " " + 300);
}
}
}

System.out.println(reaperCommand);
System.out.println(destroyerCommand);
System.out.println(doofCommand);

// for (int i = print; i < 3; i++) {
// System.out.println("WAIT");
// }
// System.out.println("WAIT");
// System.out.println("WAIT");
// System.out.println("WAIT");
}
}
}

class Wreck {

public int extra2;
public int extra;
public int vy;
public int vx;
public int y;
public int x;
public int radius;
public float mass;
public int player;
public int unitType;
public int unitId;

}

class Reaper {

public int extra2;
public int extra;
public int vy;
public int vx;
public int y;
public int x;
public int radius;
public float mass;
public int player;
public int unitType;
public int unitId;

}

class Destroyer {
public int extra2;
public int extra;
public int vy;
public int vx;
public int y;
public int x;
public int radius;
public float mass;
public int player;
public int unitType;
public int unitId;

}

class Tanker {
public int extra2;
public int extra;
public int vy;
public int vx;
public int y;
public int x;
public int radius;
public float mass;
public int player;
public int unitType;
public int unitId;

}

class Doof {
public int extra2;
public int extra;
public int vy;
public int vx;
public int y;
public int x;
public int radius;
public float mass;
public int player;
public int unitType;
public int unitId;

}