diff --git a/28.jar b/28.jar new file mode 100644 index 0000000..81a3905 Binary files /dev/null and b/28.jar differ diff --git a/core/src/MyStrategy.java b/core/src/MyStrategy.java index 95d4f31..445a022 100755 --- a/core/src/MyStrategy.java +++ b/core/src/MyStrategy.java @@ -89,7 +89,6 @@ public final class MyStrategy implements Strategy { private VehicleGroupInfo currentMapGroup; private Map cornersPushers; private Map sidesPushers; - private Map allFacCounts; private boolean isFacilityMode; private boolean nextIsTankIfFog = true; private boolean allEnInvisible; @@ -167,6 +166,8 @@ private void potentialMove() { continue; } + if (initialRotate(myGroup)) continue; + if (initialScale(myGroup)) continue; if (myGroup.goToFacility != null && myGroup.getAveragePoint().getDistanceTo(myGroup.getGoToFacilityPoint()) < 14) { @@ -638,7 +639,7 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin //if someone closer then my then pass that facility - removeFacilityIfSomeoneCloser(group); + //removeFacilityIfSomeoneCloser(group); addToArrayNotOurFacilities(plainArray, range, .9f, group); @@ -754,15 +755,19 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin { //add negative to corners int maxDistanceSquare = 8 * 8; + int distanceToFac = 6; + int maxIndex = plainArray.cellsWidth - 1; + Map allFacCounts; - if (allFacCounts == null) { - allFacCounts = new HashMap<>(); - for (Map> map : getFacilitiesCount().values()) { - for (Map counts : map.values()) { - allFacCounts.putAll(counts); - } - } + + allFacCounts = new HashMap<>(); + for (Map counts : getFacilitiesCount().get(opponent.getId()).values()) { + allFacCounts.putAll(counts); + } + + for (Map counts : getFacilitiesCount().get(-1L).values()) { + allFacCounts.putAll(counts); } if (cornersPushers == null) { @@ -774,18 +779,18 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin cornersPushers.put(new Point2D(maxIndex, maxIndex), 1); - cornersPushers.keySet().removeIf(corner -> { - for (Point2D facPoint : allFacCounts.keySet()) { - if (facPoint.squareDistance(corner) < 13 * 13) { - return true; - } + } + HashMap cornerPushersFiltered = new HashMap<>(cornersPushers); + cornerPushersFiltered.keySet().removeIf(corner -> { + for (Point2D facPoint : allFacCounts.keySet()) { + if (facPoint.squareDistance(corner) < maxDistanceSquare) { + return true; } - return false; - }); + } + return false; + }); - } - HashMap cornerPushersFiltered = new HashMap<>(cornersPushers); cornerPushersFiltered.keySet().removeIf(corner -> { int distanceThreshold = 13 * 13; @@ -820,6 +825,7 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin return false; }); + subFromArray(plainArray, cornerPushersFiltered.entrySet(), 3 * 4, 3, -1); if (sidesPushers == null) { @@ -832,18 +838,32 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin sidesPushers.put(new Point2D(maxIndex, i), 1); } + } + HashMap sidesPushersFiltered = new HashMap<>(sidesPushers); - sidesPushers.keySet().removeIf(side -> { - for (Point2D facPoint : allFacCounts.keySet()) { - if (facPoint.squareDistance(side) < maxDistanceSquare) { - return true; - } + sidesPushersFiltered.keySet().removeIf(side -> { + for (Point2D facPoint : allFacCounts.keySet()) { + if (facPoint.squareDistance(side) < maxDistanceSquare) { + return true; } - return false; - }); - } + } + return false; + }); + + + subFromArray(plainArray, sidesPushersFiltered.entrySet(), 3 * 3, 1, -1); - subFromArray(plainArray, sidesPushers.entrySet(), 3 * 3, 1, -1); + + //strict { + + for (int x = 0; x < plainArray.cellsWidth; x++) { + for (int y = 0; y < plainArray.cellsHeight; y++) { + + if (x == 0 || y == 0 || x == plainArray.cellsWidth - 1 || y == plainArray.cellsHeight - 1) { + plainArray.set(x, y, plainArray.get(x, y) - 30); + } + } + } } @@ -1272,6 +1292,30 @@ private boolean executeDelayedMove() { return true; } + private boolean initialRotate(VehicleGroupInfo myGroup) { + if (!myGroup.isRotated && myGroup.vehicles.get(0).v.isAerial()) { + myGroup.isRotated = true; + scheduleSelectAll(myGroup); + delayedMoves.add(move1 -> { + move1.setAction(ActionType.ROTATE); + move1.setX(myGroup.getAveragePoint().getX()); + move1.setY(myGroup.getAveragePoint().getY()); + move1.setAngle(Math.PI / 4); + }); + + delayedMoves.add(move1 -> { + //pass + }); + + delayedMoves.add(move1 -> { + //pass + }); + + return true; + } + return false; + } + private boolean initialScale(VehicleGroupInfo myGroup) { if (!myGroup.isScaled) { @@ -1722,7 +1766,7 @@ private void actualMoveToPoint(VehicleGroupInfo myGroup, Point2D point, Move mov // boolean shouldScale = separatedVehicles.size() > 0; boolean shouldScale = Math.sqrt(myGroup.count) * 6 < Math.max(myGroup.pointsInfo.rect.getWidth(), myGroup.pointsInfo.rect.getHeight()); - shouldScale = world.getTickIndex() - myGroup.lastShrinkForGatherI > 400 && shouldScale; + shouldScale = world.getTickIndex() - myGroup.lastShrinkForGatherI > 350 && shouldScale; if (shouldScale) { myGroup.lastShrinkForGatherI = world.getTickIndex(); diff --git a/core/src/RewindClientWrapper.java b/core/src/RewindClientWrapper.java index 1399c2f..ddb505e 100644 --- a/core/src/RewindClientWrapper.java +++ b/core/src/RewindClientWrapper.java @@ -190,9 +190,11 @@ private void drawPP(VehicleGroupInfo myGroup) { double root = root(delta, delta); - double squareMaxDistance = Math.pow(cellSize * (6 + 3), 2); + int maxDistance = 15; + double squareMaxDistance = Math.pow(cellSize * maxDistance, 2); + mys.log("start draw " + myGroup.vehicleType); for (int x = 0; x < cellsX; x++) { for (int y = 0; y < cellsY; y++) { double v = plainArray.get(x, y) - min; @@ -208,16 +210,16 @@ private void drawPP(VehicleGroupInfo myGroup) { if (RESTRICTED_PP_DRAW && myGroup.getAveragePoint().squareDistance(centerX, centerY) > squareMaxDistance) { continue; // too far for decide } - + //mys.log(String.format("%s %s %s - v: %s", myGroup.vehicleType, realX, realY, (int) v)); + //System.out.print(String.format("%s %s %s - v: %s", myGroup.vehicleType, realX, realY, (int) v)); + // System.out.print((int) v + " "); rc.rect(realX, realY, realX + cellSize, realY + cellSize, new Color(133, alpha, 255 - alpha, 100), 1); - } } + // System.out.println(); } // rc.message(String.format("\\n%s\\nMap Draw: min %.2f max %.2f \\ndelta %.2f", myGroup.vehicleType, min, max, delta)); - - } private void drawMoveActual() { diff --git a/core/src/Runner.java b/core/src/Runner.java index 390dba6..fbdd408 100755 --- a/core/src/Runner.java +++ b/core/src/Runner.java @@ -46,7 +46,8 @@ public static void main(String[] args) throws IOException { //runProc(null, true, "java", "-cp", "23.4.jar", "Runner"); //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", "25.jar", "Runner"); + runProc(null, true, "java", "-cp", "27.jar", "Runner"); } }).start(); new Runner(new String[]{"127.0.0.1", hasArgs ? "31001" : "31002", "0000000000000000"}).run(); diff --git a/core/src/VehicleGroupInfo.java b/core/src/VehicleGroupInfo.java index 88842eb..c1d90de 100644 --- a/core/src/VehicleGroupInfo.java +++ b/core/src/VehicleGroupInfo.java @@ -17,6 +17,7 @@ public class VehicleGroupInfo { public int lastShrinkI; public int lastShrinkForGatherI; public boolean isScaled; + public boolean isRotated; public boolean shouldHeal; public int groupNumber; public PlainArray potentialMap; diff --git a/lr/local-runner-sync.default.properties b/lr/local-runner-sync.default.properties index 0ee9f33..780aa16 100755 --- a/lr/local-runner-sync.default.properties +++ b/lr/local-runner-sync.default.properties @@ -65,6 +65,7 @@ fog-of-war-quality=1 #seed=536603617854755 #seed=539675860738317 #seed=541562105365045 +#seed=560101143593578 seed= # Путь к каталогу с плагинами или пустая строка для работы без плагинов.