Skip to content

Commit

Permalink
- fix nuclears; - fix fears;
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry committed Dec 17, 2017
1 parent 6306b33 commit 03cc949
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 23 deletions.
Binary file added 33.jar
Binary file not shown.
41 changes: 25 additions & 16 deletions core/src/MyStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ private boolean scaleOperations(VehicleGroupInfo myGroup) {
return true;
}


}

}
Expand Down Expand Up @@ -464,16 +463,21 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin
addToArray(plainArray, enemyTanks, range, .1f);
addToArray(plainArray, enemyArrvs, range, .1f);

subFromArray(plainArray, enemyTanks, (game.getIfvAerialAttackRange() + 10) / cellSize, 1.4f, -1);
subFromArray(plainArray, enemyArrvs, (game.getIfvAerialAttackRange() + 10) / cellSize, 1.4f, -1);
if (enemyFighters.isEmpty() && enemyHelics.isEmpty()) {
subFromArray(plainArray, enemyTanks, (game.getFighterVisionRange() - 15) / cellSize, 1.4f, -1);
subFromArray(plainArray, enemyArrvs, (game.getFighterVisionRange() - 15) / cellSize, 1.4f, -1);
} else {
subFromArray(plainArray, enemyTanks, (game.getIfvAerialAttackRange() + 10) / cellSize, 1.4f, -1);
subFromArray(plainArray, enemyArrvs, (game.getIfvAerialAttackRange() + 10) / cellSize, 1.4f, -1);
}
}
}


{
Set<Map.Entry<Point2D, Integer>> ifvCount = getUnitsCount(true).get(IFV).entrySet();

double range = (game.getIfvAerialAttackRange() * 1.8) / cellSize;
double range = (game.getIfvAerialAttackRange() * 2.4) / cellSize;

int factor = 6;

Expand Down Expand Up @@ -561,7 +565,7 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin
}

if (!disableFear) {
subFromArray(plainArray, enemyIfv, (game.getHelicopterAerialAttackRange() + 30) / cellSize, 3.2f, minValForContra);
subFromArray(plainArray, enemyIfv, (game.getHelicopterAerialAttackRange() * 2.4) / cellSize, 3.2f, minValForContra);
subFromArray(plainArray, enemyHelics, (game.getIfvAerialAttackRange() + 10) / cellSize, 1.4f, minValForContra);
}

Expand Down Expand Up @@ -1509,19 +1513,24 @@ private boolean tryPickNuclearTarget() {
log(Utils.LOG_NUCLEAR_STRIKE + " start " + max);
});

delayedMoves.addFirst(move1 -> {
move.setAction(ActionType.MOVE);
move.setX(0);
move.setY(0);
log(Utils.LOG_NUCLEAR_STRIKE + " stop unit " + max);
});
double startDistance = max.myVehicle.getPos(0).getDistanceTo(max.target);
double nextTickDistance = max.myVehicle.getPos(1).getDistanceTo(max.target);

delayedMoves.addFirst(move1 -> {
clearAndSelectOneUnit(max, move1, max.myVehicle); //TODO select group
if (nextTickDistance > startDistance) { //stop right there
delayedMoves.addFirst(move1 -> {
move.setAction(ActionType.MOVE);
move.setX(0);
move.setY(0);
log(Utils.LOG_NUCLEAR_STRIKE + " stop unit " + max);
});

scheduledStrike.createdAt = world.getTickIndex();
log(Utils.LOG_NUCLEAR_STRIKE + " select unit " + max);
});
delayedMoves.addFirst(move1 -> {
clearAndSelectOneUnit(max, move1, max.myVehicle); //TODO select group

scheduledStrike.createdAt = world.getTickIndex();
log(Utils.LOG_NUCLEAR_STRIKE + " select unit " + max);
});
}
return true;
}

Expand Down
16 changes: 11 additions & 5 deletions core/src/NuclearStrike.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ private void calcPredicted(VehicleWrapper myVehicle, VehicleWrapper target, MySt
.mapToDouble(veh -> {
double distanceTo;
if (actualTarget != null) {
distanceTo = veh.getPos(PREDICTION_TICK).getDistanceTo(actualTarget);
if (veh.isEnemy) {
distanceTo = veh.getPos(0).getDistanceTo(actualTarget);
} else {
distanceTo = veh.getPos(30).getDistanceTo(actualTarget);
}
} else {
distanceTo = veh.getDistanceToPredictBoth(target, PREDICTION_TICK);
if (veh.isEnemy) {
distanceTo = veh.getDistanceToPredictBoth(target, 0);
} else {
distanceTo = veh.getPos(30).getDistanceTo(target);
}
}

if (distanceTo > maxRadius) {
Expand Down Expand Up @@ -100,9 +108,7 @@ public static NuclearStrike getMaxDmg(MyStrategy mys, int minNuclearDmg) {
.filter(myVehicle ->
myVehicle.getDistanceToPredictTarget(v, PREDICTION_TICK) < myVehicle.getActualVisionRange())
.map(myVehicle -> new NuclearStrike(myVehicle, v, mys)))
.filter(nuclearStrike -> {
return nuclearStrike.predictedDmg > minNuclearDmg;
})
.filter(nuclearStrike -> nuclearStrike.predictedDmg > minNuclearDmg)
.max(Comparator.comparingDouble(o -> o.predictedDmg))
.orElse(null);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void main(String[] args) throws IOException {
//runProc(null, true, "java", "-cp", "23.5.jar", "Runner");
//runProc(null, true, "java", "-cp", "24.jar", "Runner");
//runProc(null, true, "java", "-cp", "25.jar", "Runner");
runProc(null, true, "java", "-cp", "32.jar", "Runner");
runProc(null, true, "java", "-cp", "33.jar", "Runner");
}
}).start();
new Runner(new String[]{"127.0.0.1", hasArgs ? "31001" : "31002", "0000000000000000"}).run();
Expand Down
3 changes: 2 additions & 1 deletion lr/local-runner-sync.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ fog-of-war-quality=1
#seed=539675860738317
#seed=541562105365045
#seed=560101143593578
seed=562820576579634
#seed=562820576579634
seed=

# Путь к каталогу с плагинами или пустая строка для работы без плагинов.
# Необходимо скомпилировать плагин, чтобы он загрузился игровым симулятором.
Expand Down

0 comments on commit 03cc949

Please sign in to comment.