From 4c55f361d6cd2477b4b4d5c10146fe6a4e630003 Mon Sep 17 00:00:00 2001 From: dunescifye Date: Sun, 7 Dec 2025 12:43:45 -0500 Subject: [PATCH 1/2] Removing leftover paint remanents with crouching --- .../src/main/battlecode/common/RobotInfo.java | 2 +- .../main/battlecode/world/InternalRobot.java | 24 ++++++------------- .../src/main/battlecode/world/MapBuilder.java | 2 +- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/engine/src/main/battlecode/common/RobotInfo.java b/engine/src/main/battlecode/common/RobotInfo.java index aedc8d78..7dc79e86 100644 --- a/engine/src/main/battlecode/common/RobotInfo.java +++ b/engine/src/main/battlecode/common/RobotInfo.java @@ -44,7 +44,7 @@ public RobotInfo(int ID, Team team, UnitType type, int health, MapLocation locat this.type = type; this.health = health; this.location = location; - this.crouching = type.isRatType() && crouching; + this.crouching = type.isCatType() && crouching; } /** diff --git a/engine/src/main/battlecode/world/InternalRobot.java b/engine/src/main/battlecode/world/InternalRobot.java index 615b7419..32ce2163 100644 --- a/engine/src/main/battlecode/world/InternalRobot.java +++ b/engine/src/main/battlecode/world/InternalRobot.java @@ -20,7 +20,6 @@ public class InternalRobot implements Comparable { private final RobotControllerImpl controller; protected final GameWorld gameWorld; - private int paintAmount; private UnitType type; private final int ID; @@ -76,7 +75,7 @@ public InternalRobot(GameWorld gw, int id, Team team, UnitType type, MapLocation this.incomingMessages = new LinkedList<>(); this.towerHasSingleAttacked = this.towerHasAreaAttacked = false; - this.paintAmount = 0; + this.crouching = false; this.controlBits = 0; this.currentBytecodeLimit = type.isRobotType() ? GameConstants.ROBOT_BYTECODE_LIMIT : GameConstants.TOWER_BYTECODE_LIMIT; @@ -143,19 +142,8 @@ public int getHealth() { return health; } - public int getPaint() { - return paintAmount; - } - - public void addPaint(int amount) { - int newPaintAmount = this.paintAmount + amount; - if (newPaintAmount > this.type.paintCapacity) { - this.paintAmount = this.type.paintCapacity; - } else if (newPaintAmount < 0) { - this.paintAmount = 0; - } else { - this.paintAmount = newPaintAmount; - } + public boolean getCrouching() { + return crouching; } public boolean hasTowerSingleAttacked() { @@ -198,12 +186,12 @@ public RobotInfo getRobotInfo() { && cachedRobotInfo.ID == ID && cachedRobotInfo.team == team && cachedRobotInfo.health == health - && cachedRobotInfo.paintAmount == paintAmount + && cachedRobotInfo.crouching == crouching && cachedRobotInfo.location.equals(location)) { return cachedRobotInfo; } - this.cachedRobotInfo = new RobotInfo(ID, team, type, health, location, paintAmount); + this.cachedRobotInfo = new RobotInfo(ID, team, type, health, location, crouching); return this.cachedRobotInfo; } @@ -683,9 +671,11 @@ public void processEndOfTurn() { */ } + /* if (this.paintAmount == 0 && type.isRobotType()){ // TODO this is paint depletion logic this.addHealth(-GameConstants.NO_PAINT_DAMAGE); } + */ this.gameWorld.getMatchMaker().endTurn(this.ID, this.health, this.paintAmount, this.movementCooldownTurns, this.actionCooldownTurns, this.bytecodesUsed, this.location); this.roundsAlive++; diff --git a/engine/src/main/battlecode/world/MapBuilder.java b/engine/src/main/battlecode/world/MapBuilder.java index 0584e936..23a90010 100644 --- a/engine/src/main/battlecode/world/MapBuilder.java +++ b/engine/src/main/battlecode/world/MapBuilder.java @@ -97,7 +97,7 @@ public void addTower(int id, Team team, MapLocation loc) { UnitType.LEVEL_ONE_PAINT_TOWER, UnitType.LEVEL_ONE_PAINT_TOWER.health, loc, - 500 + false )); } From ed9678c47210f34039126791ab4574c5cabc2491 Mon Sep 17 00:00:00 2001 From: dunescifye Date: Sun, 7 Dec 2025 12:46:50 -0500 Subject: [PATCH 2/2] Removing leftover paint remanents with crouching --- engine/src/main/battlecode/common/RobotInfo.java | 4 ++-- engine/src/main/battlecode/world/InternalRobot.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/src/main/battlecode/common/RobotInfo.java b/engine/src/main/battlecode/common/RobotInfo.java index 39a056f6..df1d1c8d 100644 --- a/engine/src/main/battlecode/common/RobotInfo.java +++ b/engine/src/main/battlecode/common/RobotInfo.java @@ -42,14 +42,14 @@ public class RobotInfo { */ public final RobotInfo carryingRobot; - public RobotInfo(int ID, Team team, UnitType type, int health, MapLocation location, int paintAmount, RobotInfo carryingRobot, boolean crouching) { + public RobotInfo(int ID, Team team, UnitType type, int health, MapLocation location, RobotInfo carryingRobot, boolean crouching) { super(); this.ID = ID; this.team = team; this.type = type; this.health = health; this.location = location; - this.crouching = type.isRatType() && crouching; + this.crouching = type.isCatType() && crouching; this.carryingRobot = carryingRobot; } diff --git a/engine/src/main/battlecode/world/InternalRobot.java b/engine/src/main/battlecode/world/InternalRobot.java index 370d5d7b..8334cbfa 100644 --- a/engine/src/main/battlecode/world/InternalRobot.java +++ b/engine/src/main/battlecode/world/InternalRobot.java @@ -212,12 +212,13 @@ public RobotInfo getRobotInfo() { && cachedRobotInfo.ID == ID && cachedRobotInfo.team == team && cachedRobotInfo.health == health - && cachedRobotInfo.paintAmount == paintAmount + && cachedRobotInfo.crouching == crouching && cachedRobotInfo.location.equals(location)) { return cachedRobotInfo; } - this.cachedRobotInfo = new RobotInfo(ID, team, type, health, location, paintAmount, carryingRobot != null ? carryingRobot.getRobotInfo() : null); + this.cachedRobotInfo = new RobotInfo(ID, team, type, health, location, carryingRobot != null ? + carryingRobot.getRobotInfo() : null, crouching); return this.cachedRobotInfo; }