diff --git a/engine/src/main/battlecode/common/AnomalyType.java b/engine/src/main/battlecode/common/AnomalyType.java index 670e4ea9..2b3e0989 100644 --- a/engine/src/main/battlecode/common/AnomalyType.java +++ b/engine/src/main/battlecode/common/AnomalyType.java @@ -47,9 +47,7 @@ public enum AnomalyType { * The values of {@link #globalPercentage} and {@link #sagePercentage} are * unused. */ - VORTEX (true, false, 0, 0), - - SINGULARITY (true, false, 0, 0); + VORTEX (true, false, 0, 0); /** * Whether this type of Anomaly could appear in the global schedule. diff --git a/engine/src/main/battlecode/common/GameConstants.java b/engine/src/main/battlecode/common/GameConstants.java index 1ace50b8..36667e80 100644 --- a/engine/src/main/battlecode/common/GameConstants.java +++ b/engine/src/main/battlecode/common/GameConstants.java @@ -91,7 +91,7 @@ public class GameConstants { // ********************************* /** A blueprint building's health, as a multiplier of max health. */ - public static final float PROTOTYPE_HP_PERCENTAGE = 0.9f; + public static final float PROTOTYPE_HP_PERCENTAGE = 0.6f; /** The multiplier for reclaiming a building's cost. */ public static final float RECLAIM_COST_MULTIPLIER = 0.2f; diff --git a/engine/src/main/battlecode/common/RobotController.java b/engine/src/main/battlecode/common/RobotController.java index 0c461422..3f593bb4 100644 --- a/engine/src/main/battlecode/common/RobotController.java +++ b/engine/src/main/battlecode/common/RobotController.java @@ -189,7 +189,7 @@ public strictfp interface RobotController { boolean canSenseRadiusSquared(int radiusSquared); /** - * Checks whether a robot is at a given location. Assumes the location is valid. + * Checks whether a robot is at a given location. Assumes the location is valid. * * @param loc the location to check * @return true if a robot is at the location @@ -197,7 +197,17 @@ public strictfp interface RobotController { * * @battlecode.doc.costlymethod */ - boolean canSenseRobotAtLocation(MapLocation loc) throws GameActionException; + boolean isLocationOccupied(MapLocation loc) throws GameActionException; + + /** + * Checks whether a robot is at a given location. Assume the location is valid. + * + * @param loc the location to check + * @return true if a robot is at the location, false if there is no robot or the location can not be sensed. + * + * @battlecode.doc.costlymethod + */ + boolean canSenseRobotAtLocation(MapLocation loc); /** * Senses the robot at the given location, or null if there is no robot @@ -379,7 +389,7 @@ public strictfp interface RobotController { * * @battlecode.doc.costlymethod */ - double getActionCooldownTurns(); + int getActionCooldownTurns(); /** * Tests whether the robot can move. @@ -400,7 +410,7 @@ public strictfp interface RobotController { * * @battlecode.doc.costlymethod */ - double getMovementCooldownTurns(); + int getMovementCooldownTurns(); /** * Tests whether the robot can transform. @@ -421,10 +431,11 @@ public strictfp interface RobotController { * {@link GameConstants#COOLDOWNS_PER_TURN} every turn. * * @return the number of cooldown turns remaining before this unit can transform again + * @throws GameActionException if the robot's mode is not TURRET or PORTABLE * * @battlecode.doc.costlymethod */ - double getTransformCooldownTurns(); + int getTransformCooldownTurns() throws GameActionException; // *********************************** // ****** MOVEMENT METHODS *********** diff --git a/engine/src/main/battlecode/common/RobotType.java b/engine/src/main/battlecode/common/RobotType.java index 50606769..e6cbb0a0 100644 --- a/engine/src/main/battlecode/common/RobotType.java +++ b/engine/src/main/battlecode/common/RobotType.java @@ -167,7 +167,8 @@ public boolean canBuild(RobotType builtType) { */ public boolean canAttack() { return (this == WATCHTOWER - || this == SOLDIER); + || this == SOLDIER + || this == SAGE); } /** diff --git a/engine/src/main/battlecode/world/LiveMap.java b/engine/src/main/battlecode/world/LiveMap.java index cd870337..45ed5509 100644 --- a/engine/src/main/battlecode/world/LiveMap.java +++ b/engine/src/main/battlecode/world/LiveMap.java @@ -92,8 +92,7 @@ public LiveMap(int width, Arrays.fill(this.rubbleArray, 1); // default cooldown factor is 1 this.leadArray = new int[width * height]; // TODO: we guarantee there to be lead within vision range of archons - this.anomalySchedule = new AnomalyScheduleEntry[1]; - this.anomalySchedule[0] = new AnomalyScheduleEntry(GameConstants.GAME_MAX_NUMBER_OF_ROUNDS, AnomalyType.SINGULARITY); + this.anomalySchedule = new AnomalyScheduleEntry[0]; this.nextAnomalyIndex = 0; // invariant: bodies is sorted by id diff --git a/engine/src/main/battlecode/world/RobotControllerImpl.java b/engine/src/main/battlecode/world/RobotControllerImpl.java index c1500c7c..f67336fd 100644 --- a/engine/src/main/battlecode/world/RobotControllerImpl.java +++ b/engine/src/main/battlecode/world/RobotControllerImpl.java @@ -203,11 +203,18 @@ public boolean canSenseRadiusSquared(int radiusSquared) { } @Override - public boolean canSenseRobotAtLocation(MapLocation loc) throws GameActionException { + public boolean isLocationOccupied(MapLocation loc) throws GameActionException { assertCanSenseLocation(loc); return this.gameWorld.getRobot(loc) != null; } + @Override + public boolean canSenseRobotAtLocation(MapLocation loc) { + try { + return isLocationOccupied(loc); + } catch (GameActionException e) { return false; } + } + @Override public RobotInfo senseRobotAtLocation(MapLocation loc) throws GameActionException { assertCanSenseLocation(loc); @@ -301,10 +308,6 @@ public MapLocation[] getAllLocationsWithinRadiusSquared(MapLocation center, int // ****** READINESS METHODS ********** // *********************************** - private boolean isLocationOccupied(MapLocation loc) throws GameActionException { - return this.gameWorld.getRobot(loc) != null; - } - private void assertIsActionReady() throws GameActionException { if (!this.robot.getMode().canAct) throw new GameActionException(CANT_DO_THAT, @@ -323,7 +326,7 @@ public boolean isActionReady() { } @Override - public double getActionCooldownTurns() { + public int getActionCooldownTurns() { return this.robot.getActionCooldownTurns(); } @@ -345,7 +348,7 @@ public boolean isMovementReady() { } @Override - public double getMovementCooldownTurns() { + public int getMovementCooldownTurns() { return this.robot.getMovementCooldownTurns(); } @@ -368,7 +371,10 @@ public boolean isTransformReady() { } @Override - public double getTransformCooldownTurns() { + public int getTransformCooldownTurns() throws GameActionException { + if (!this.robot.getMode().canTransform) + throw new GameActionException(CANT_DO_THAT, + "This robot is not in a mode that can transform."); return this.robot.getTransformCooldownTurns(); }