diff --git a/build.gradle b/build.gradle index 2e2c4fb3..216be097 100644 --- a/build.gradle +++ b/build.gradle @@ -272,13 +272,6 @@ task releaseClientLinux32(type: Zip, dependsOn: ['prodClient']) { -task updateVersion() { - // new File("frontend/public/version.txt").write(project.findProperty('release_version')) -} - - - -publish.dependsOn(updateVersion) publishing { repositories { maven { @@ -296,11 +289,10 @@ publishing { publications { server(MavenPublication) { groupId 'org.battlecode' - artifactId 'battlecode21' + artifactId 'battlecode22' version project.findProperty('release_version') ?: 'NONSENSE' artifact release_main - artifact release_docs { classifier 'javadoc' @@ -312,7 +304,7 @@ publishing { clientWin(MavenPublication) { groupId 'org.battlecode' - artifactId 'battlecode21-client-win' + artifactId 'battlecode22-client-win' version project.findProperty('release_version') ?: 'NONSENSE' artifact releaseClientWin @@ -320,7 +312,7 @@ publishing { clientMac(MavenPublication) { groupId 'org.battlecode' - artifactId 'battlecode21-client-mac' + artifactId 'battlecode22-client-mac' version project.findProperty('release_version') ?: 'NONSENSE' artifact releaseClientMac @@ -328,7 +320,7 @@ publishing { clientLinux(MavenPublication) { groupId 'org.battlecode' - artifactId 'battlecode21-client-linux' + artifactId 'battlecode22-client-linux' version project.findProperty('release_version') ?: 'NONSENSE' artifact releaseClientLinux @@ -336,7 +328,7 @@ publishing { clientWin32(MavenPublication) { groupId 'org.battlecode' - artifactId 'battlecode21-client-win-32' + artifactId 'battlecode22-client-win-32' version project.findProperty('release_version') ?: 'NONSENSE' artifact releaseClientWin32 @@ -344,7 +336,7 @@ publishing { clientLinux32(MavenPublication) { groupId 'org.battlecode' - artifactId 'battlecode21-client-linux-32' + artifactId 'battlecode22-client-linux-32' version project.findProperty('release_version') ?: 'NONSENSE' artifact releaseClientLinux32 diff --git a/engine/src/main/battlecode/common/AnomalyScheduleEntry.java b/engine/src/main/battlecode/common/AnomalyScheduleEntry.java index eef5c249..5c9df6e4 100644 --- a/engine/src/main/battlecode/common/AnomalyScheduleEntry.java +++ b/engine/src/main/battlecode/common/AnomalyScheduleEntry.java @@ -1,30 +1,67 @@ package battlecode.common; +/** + * AnomalyScheduleEntry describes a single Anomaly in the Anomaly schedule. The + * schedule of Anomalies is predetermined for each map, and you can retrieve it + * by calling {@link RobotController#getAnomalySchedule}. Each schedule entry + * provides information about the round on which it occurs, and the type of the + * Anomaly. + *

+ * Note that the Singularity is not included in the schedule. You should instead + * check {@link GameConstants#GAME_MAX_NUMBER_OF_ROUNDS}. + */ public class AnomalyScheduleEntry { - + /** + * The round on which this Anomaly will occur. The Anomaly will occur at the + * end of this round, that is, after all robots have taken their turn. + */ public final int roundNumber; + + /** + * The type of this Anomaly. + */ public final AnomalyType anomalyType; - public AnomalyScheduleEntry(int round, AnomalyType anomaly) { + /** + * Constructs an AnomalyScheduleEntry using the given round number and + * Anomaly type. Note that this does not actually insert the Anomaly into + * the schedule, but only creates a local object that you are free to + * manipulate. The global Anomaly schedule is fixed and cannot be changed; + * to envision an Anomaly with a Sage, see {@link RobotController#envision}. + * + * @param round the round number of the Anomaly + * @param type the type of the Anomaly + */ + public AnomalyScheduleEntry(int round, AnomalyType type) { this.roundNumber = round; - this.anomalyType = anomaly; + this.anomalyType = type; } /** - * @return a copy of the entry + * Constructs a copy of this schedule entry. Note that this does not + * actually cause the Anomaly to happen twice, but only creates a local + * object that you are free to manipulate. The global Anomaly schedule is + * fixed and cannot be changed; to envision an Anomaly with a Sage, see + * {@link RobotController#envision}. + * + * @return a copy of this AnomalyScheduleEntry */ public AnomalyScheduleEntry copyEntry() { return new AnomalyScheduleEntry(this.roundNumber, this.anomalyType); } /** - * Returns whether two AnomalyScheduleEntrys are equal. + * Returns whether two AnomalyScheduleEntry objects are equivalent. + * + * @param other the AnomalyScheduleEntry to compare with + * @return whether the two AnomalyScheduleEntry objects are equivalent * - * @param other the other anomaly schedule entry to compare to - * @return whether the two anomaly schedules entry are equivalent + * @battlecode.doc.costlymethod */ - public boolean equals(AnomalyScheduleEntry other) { - if (this.roundNumber != other.roundNumber) return false; - return this.anomalyType == other.anomalyType; + @Override + public boolean equals(Object other) { + if (other == null || getClass() != other.getClass()) return false; + AnomalyScheduleEntry casted = (AnomalyScheduleEntry) other; + return this.roundNumber == casted.roundNumber && this.anomalyType == casted.anomalyType; } } diff --git a/engine/src/main/battlecode/common/AnomalyType.java b/engine/src/main/battlecode/common/AnomalyType.java index 8b984671..2b3e0989 100644 --- a/engine/src/main/battlecode/common/AnomalyType.java +++ b/engine/src/main/battlecode/common/AnomalyType.java @@ -1,17 +1,74 @@ package battlecode.common; /** - * Holds the different anomalies in the game. + * AnomalyType represents the type of a scheduled or envisioned Anomaly. You + * can access the type of scheduled Anomalies from + * {@link AnomalyScheduleEntry#anomalyType}, and envision your own Anomalies with + * Sages by using {@link RobotController#envision}. + *

+ * AnomalyType also provides information about the strenghts of each Anomaly, as + * well as other properties. + *

+ * Note that the Singularity is not included in the schedule. You should instead + * check {@link GameConstants#GAME_MAX_NUMBER_OF_ROUNDS}. */ public enum AnomalyType { + /** + * Abyss causes proportional amounts of metal resources to be lost. When + * global, the entire map as well as team reserves are affected. When + * envisioned, a local region of the map is affected. + *

+ * {@link #globalPercentage} and {@link #sagePercentage} specify the + * proportion of metals lost. + */ ABYSS (true, true, 0.1f, 0.2f), + + /** + * Charge deals concentrated damage to Droids. When global, the top + * {@link #globalPercentage} Droids with the most nearby friendly units are + * destroyed. When envisioned, all nearby enemy Droids lose + * {@link #sagePercentage} of their maximum health. + */ CHARGE (true, true, 0.05f, 0.1f), + + /** + * Fury deals concentrated proportional damage to Turrets. When global, all + * Turrets are affected. When envisioned, a local region is affected. + *

+ * {@link #globalPercentage} and {@link #sagePercentage} specify the + * amount of damage dealt, as a proportion of the Turret's maximum health. + */ FURY (true, true, 0.05f, 0.1f), + + /** + * Vortex upends the world by transforming the map terrain. It can only + * occur globally. + *

+ * The values of {@link #globalPercentage} and {@link #sagePercentage} are + * unused. + */ VORTEX (true, false, 0, 0); - + + /** + * Whether this type of Anomaly could appear in the global schedule. + */ public final boolean isGlobalAnomaly; + + /** + * Whether this type of Anomaly could be envisioned by Sages. + */ public final boolean isSageAnomaly; + + /** + * The strength of this Anomaly when globally scheduled. The precise + * definition of this value depends on the Anomaly type. + */ public final float globalPercentage; + + /** + * The strength of this Anomaly when envisioned by a Sage. The precise + * definition of this value depends on the Anomaly type. + */ public final float sagePercentage; AnomalyType(boolean isGlobalAnomaly, boolean isSageAnomaly, float globalPercentage, float sagePercentage) { @@ -20,4 +77,4 @@ public enum AnomalyType { this.globalPercentage = globalPercentage; this.sagePercentage = sagePercentage; } -} \ No newline at end of file +} diff --git a/engine/src/main/battlecode/common/BodyInfo.java b/engine/src/main/battlecode/common/BodyInfo.java deleted file mode 100644 index b8f008f4..00000000 --- a/engine/src/main/battlecode/common/BodyInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package battlecode.common; - -/** - * Stores information about a Object/Body in the game world - */ -public interface BodyInfo { - - /** - * Returns the ID of this body. - * - * @return the ID of this body. - */ - int getID(); - - /** - * Returns the center location of this body. - * - * @return the center location of this body. - */ - MapLocation getLocation(); - - /** - * Returns whether this body is a robot. - * - * @return true if this body is a robot; false otherwise. - */ - boolean isRobot(); -} diff --git a/engine/src/main/battlecode/common/Clock.java b/engine/src/main/battlecode/common/Clock.java index f3bba5ff..bd820a04 100644 --- a/engine/src/main/battlecode/common/Clock.java +++ b/engine/src/main/battlecode/common/Clock.java @@ -3,15 +3,14 @@ import battlecode.instrumenter.inject.RobotMonitor; /** - * Clock is a singleton that allows contestants to introspect the state of their running - * code. + * Clock is a singleton that allows contestants to introspect the state of their + * running code. * * @author james */ @SuppressWarnings("unused") public final class Clock { - - /** + /* * IMPORTANT NOTE! * This class is reloaded for every individual robot. * See Loader for more information. @@ -28,8 +27,8 @@ public static void yield() { /** * Returns the number of bytecodes this robot has left in this round. - * @return the number of bytecodes this robot has left in this round. * + * @return the number of bytecodes this robot has left in this round * @battlecode.doc.costlymethod */ public static int getBytecodesLeft() { @@ -37,11 +36,11 @@ public static int getBytecodesLeft() { } /** - * Returns the number of bytecodes the current robot has executed since the beginning - * of the current round. - * @return the number of bytecodes the current robot has executed since the beginning - * of the current round. + * Returns the number of bytecodes the current robot has executed since the + * beginning of the current round. * + * @return the number of bytecodes the current robot has executed since the + * beginning of the current round * @battlecode.doc.costlymethod */ public static int getBytecodeNum() { diff --git a/engine/src/main/battlecode/common/Direction.java b/engine/src/main/battlecode/common/Direction.java index bcc9a6d0..f8253149 100644 --- a/engine/src/main/battlecode/common/Direction.java +++ b/engine/src/main/battlecode/common/Direction.java @@ -50,9 +50,14 @@ public enum Direction { CENTER(0, 0); /** - * Change in x, change in y. + * Change in x. */ - public final int dx, dy; + public final int dx; + + /** + * Change in y. + */ + public final int dy; Direction(int dx, int dy) { this.dx = dx; @@ -102,9 +107,9 @@ public Direction rotateRight() { /** * Returns a list of all directions. This is equivalent to calling - * Direction.values(). + * {@link Direction#values}. * - * @return array of all directions. + * @return array of all directions */ public static Direction[] allDirections() { return Direction.values(); @@ -113,7 +118,7 @@ public static Direction[] allDirections() { /** * Returns a list of all cardinal directions. * - * @return array of all cardinal directions. + * @return array of all cardinal directions */ public static Direction[] cardinalDirections() { return new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}; @@ -122,7 +127,7 @@ public static Direction[] cardinalDirections() { /** * Returns the delta X of the direction. * - * @return the delta X of the direction. + * @return the delta X of the direction */ public int getDeltaX() { return this.dx; @@ -131,9 +136,9 @@ public int getDeltaX() { /** * Returns the delta Y of the direction. * - * @return the delta Y of the direction. + * @return the delta Y of the direction */ public int getDeltaY() { return this.dy; } -} \ No newline at end of file +} diff --git a/engine/src/main/battlecode/common/GameActionException.java b/engine/src/main/battlecode/common/GameActionException.java index 4bf70fd7..cdd92fd8 100644 --- a/engine/src/main/battlecode/common/GameActionException.java +++ b/engine/src/main/battlecode/common/GameActionException.java @@ -35,7 +35,7 @@ public GameActionException(GameActionExceptionType type, String message) { * Gives the type of gameworld interaction that caused this GameActionException, which * was specified when this instance was constructed. * - * @return this GameActionException's type. + * @return this GameActionException's type */ public GameActionExceptionType getType() { return type; diff --git a/engine/src/main/battlecode/common/GameConstants.java b/engine/src/main/battlecode/common/GameConstants.java index 6186ae19..36667e80 100644 --- a/engine/src/main/battlecode/common/GameConstants.java +++ b/engine/src/main/battlecode/common/GameConstants.java @@ -1,7 +1,7 @@ package battlecode.common; /** - * Defines constants that affect gameplay. + * GameConstants defines constants that affect gameplay. */ @SuppressWarnings("unused") public class GameConstants { @@ -9,7 +9,7 @@ public class GameConstants { /** * The current spec version the server compiles with. */ - public static final String SPEC_VERSION = "1.0"; + public static final String SPEC_VERSION = "2022.0.1.0"; // ********************************* // ****** MAP CONSTANTS ************ @@ -74,7 +74,7 @@ public class GameConstants { // ****** COOLDOWNS **************** // ********************************* - /** If the number of cooldown turns is >= this number, a robot cannot act. */ + /** If the amount of cooldown is at least this value, a robot cannot act. */ public static final int COOLDOWN_LIMIT = 10; /** The number of cooldown turns reduced per turn. */ diff --git a/engine/src/main/battlecode/common/MapLocation.java b/engine/src/main/battlecode/common/MapLocation.java index 12884b5d..60ee629e 100644 --- a/engine/src/main/battlecode/common/MapLocation.java +++ b/engine/src/main/battlecode/common/MapLocation.java @@ -138,7 +138,7 @@ public final boolean isAdjacentTo(MapLocation location) { * If location equals this location then the return value is Direction.CENTER. * * @param location The location to which the Direction will be calculated - * @return The Direction to location from this MapLocation. + * @return the Direction to location from this MapLocation * * @battlecode.doc.costlymethod */ diff --git a/engine/src/main/battlecode/common/RobotController.java b/engine/src/main/battlecode/common/RobotController.java index 2590d283..3f593bb4 100644 --- a/engine/src/main/battlecode/common/RobotController.java +++ b/engine/src/main/battlecode/common/RobotController.java @@ -26,7 +26,8 @@ public strictfp interface RobotController { int getRoundNum(); /** - * Returns map width. + * Returns the width of the game map. Valid x coordinates range from + * 0 (inclusive) to the width (exclusive). * * @return the map width * @@ -35,7 +36,8 @@ public strictfp interface RobotController { int getMapWidth(); /** - * Returns map height. + * Returns the height of the game map. Valid y coordinates range from + * 0 (inclusive) to the height (exclusive). * * @return the map height * @@ -66,6 +68,7 @@ public strictfp interface RobotController { /** * Returns the amount of lead a team has in its reserves. * + * @param team the team being queried. * @return the amount of lead a team has in its reserves. * * @battlecode.doc.costlymethod @@ -75,6 +78,7 @@ public strictfp interface RobotController { /** * Returns the amount of gold a team has in its reserves. * + * @param team the team being queried. * @return the amount of gold a team has in its reserves. * * @battlecode.doc.costlymethod @@ -356,6 +360,7 @@ public strictfp interface RobotController { * @param center the given location * @param radiusSquared return locations within this distance away from center * @return list of locations on the map and within radiusSquared of center + * @throws GameActionException if the radius is negative * * @battlecode.doc.costlymethod */ @@ -376,9 +381,9 @@ public strictfp interface RobotController { /** * Returns the number of action cooldown turns remaining before this unit can act again. - * When this number is strictly less than GameConstants.COOLDOWN_LIMIT, isActionReady() + * When this number is strictly less than {@link GameConstants#COOLDOWN_LIMIT}, isActionReady() * is true and the robot can act again. This number decreases by - * GameConstants.COOLDOWNS_PER_TURN every turn. + * {@link GameConstants#COOLDOWNS_PER_TURN} every turn. * * @return the number of action turns remaining before this unit can act again * @@ -397,9 +402,9 @@ public strictfp interface RobotController { /** * Returns the number of movement cooldown turns remaining before this unit can move again. - * When this number is strictly less than GameConstants.COOLDOWN_LIMIT, isMovementReady() + * When this number is strictly less than {@link GameConstants#COOLDOWN_LIMIT}, isMovementReady() * is true and the robot can move again. This number decreases by - * GameConstants.COOLDOWNS_PER_TURN every turn. + * {@link GameConstants#COOLDOWNS_PER_TURN} every turn. * * @return the number of cooldown turns remaining before this unit can move again * @@ -421,9 +426,9 @@ public strictfp interface RobotController { /** * Returns the number of cooldown turns remaining before this unit can transform again. - * When this number is strictly less than GameConstants.COOLDOWN_LIMIT, isTransformReady() + * When this number is strictly less than {@link GameConstants#COOLDOWN_LIMIT}, isTransformReady() * is true and the robot can transform again. This number decreases by - * GameConstants.COOLDOWNS_PER_TURN every turn. + * {@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 @@ -515,6 +520,7 @@ public strictfp interface RobotController { /** * Attack a given location. * + * @param loc the target location to attack * @throws GameActionException if conditions for attacking are not satisfied * * @battlecode.doc.costlymethod @@ -530,6 +536,7 @@ public strictfp interface RobotController { * * Checks that the robot is a sage, and there are no cooldown turns remaining. * + * @param anomaly the type of anomaly being queried * @return whether it is possible to envision an anomaly centered at the robots location * * @battlecode.doc.costlymethod @@ -539,6 +546,7 @@ public strictfp interface RobotController { /** * Envision an anomaly centered at the robot's location. * + * @param anomaly the type of anomaly to envision * @throws GameActionException if conditions for envisioning are not satisfied * * @battlecode.doc.costlymethod @@ -567,6 +575,7 @@ public strictfp interface RobotController { /** * Repairs at a given location. * + * @param loc target location to repair at * @throws GameActionException if conditions for repairing are not satisfied * * @battlecode.doc.costlymethod @@ -595,6 +604,7 @@ public strictfp interface RobotController { /** * Mine lead at a given location. * + * @param loc target location to mine * @throws GameActionException if conditions for mining are not satisfied * * @battlecode.doc.costlymethod @@ -619,6 +629,7 @@ public strictfp interface RobotController { /** * Mine a gold at given location. * + * @param loc target location to mine * @throws GameActionException if conditions for mining are not satisfied * * @battlecode.doc.costlymethod @@ -647,6 +658,7 @@ public strictfp interface RobotController { /** * Mutate a building at a given location. * + * @param loc target location of the building to mutate * @throws GameActionException if conditions for mutating are not satisfied * * @battlecode.doc.costlymethod @@ -718,7 +730,7 @@ public strictfp interface RobotController { * * @param index the index in the team's shared array, 0-indexed * @return the value at that index in the team's shared array, - * or -1 if the index is invalid + * @throws GameActionException if the index is invalid * * @battlecode.doc.costlymethod */ @@ -730,6 +742,8 @@ public strictfp interface RobotController { * * @param index the index in the team's shared array, 0-indexed * @param value the value to set that index to + * @throws GameActionException if the index is invalid, or the value + * is out of bounds * * @battlecode.doc.costlymethod */ @@ -765,8 +779,8 @@ public strictfp interface RobotController { // *********************************** /** - * Sets the indicator string for this robot. Only the first - * GameConstants.INDICATOR_STRING_MAX_LENGTH characters are used. + * Sets the indicator string for this robot for debugging purposes. Only the first + * {@link GameConstants#INDICATOR_STRING_MAX_LENGTH} characters are used. * * @param string the indicator string this round * diff --git a/engine/src/main/battlecode/common/RobotInfo.java b/engine/src/main/battlecode/common/RobotInfo.java index 2b16a569..39bf872d 100644 --- a/engine/src/main/battlecode/common/RobotInfo.java +++ b/engine/src/main/battlecode/common/RobotInfo.java @@ -1,7 +1,7 @@ package battlecode.common; /** - * Struct that stores basic information that was 'sensed' of another Robot. This + * RobotInfo stores basic information that was 'sensed' of another Robot. This * info is ephemeral and there is no guarantee any of it will remain the same * between rounds. */ diff --git a/engine/src/main/battlecode/common/RobotMode.java b/engine/src/main/battlecode/common/RobotMode.java index 198147d3..2e909ebe 100644 --- a/engine/src/main/battlecode/common/RobotMode.java +++ b/engine/src/main/battlecode/common/RobotMode.java @@ -1,17 +1,52 @@ package battlecode.common; /** - * Holds the different "modes" a robot can be in, mostly useful for buildings. + * Enumerates the modes that a robot could possibly be in. The mode of a robot + * determines the set of interactions with the world that it can currently + * perform legally. + *

+ * You can check the mode of another robot by inspecting {@link RobotInfo#mode}, + * or your own mode by inspecting {@link RobotController#getMode}. */ public enum RobotMode { - + /** + * The Droid mode describes all Droid robots. These robots can always act + * and move, as long as their cooldowns permit. + */ DROID (true, true, false), + + /** + * The Prototype mode describes newly-constructed Buildings. These robots + * cannot do anything until they have been repaired to full health by a + * Builder. + */ PROTOTYPE (false, false, false), + + /** + * The Turret mode describes Buildings in Turret mode. These robots can act, + * but not move. Turrets can also transform into Portable mode. + */ TURRET (true, false, true), + + /** + * The Portable mode describes Buildings in Portable mode. These robots can + * move, but not act. Portables can also transform into Turret mode. + */ PORTABLE (false, true, true); + /** + * Whether robots in this mode may perform actions other than moving. + */ public final boolean canAct; + + /** + * Whether robots in this mode may move. + */ public final boolean canMove; + + /** + * Whether robots in this mode may transform to another mode. + */ public final boolean canTransform; RobotMode(boolean canAct, boolean canMove, boolean canTransform) { @@ -19,4 +54,4 @@ public enum RobotMode { this.canMove = canMove; this.canTransform = canTransform; } -} \ No newline at end of file +} diff --git a/engine/src/main/battlecode/common/RobotType.java b/engine/src/main/battlecode/common/RobotType.java index 3e31df1f..8c926ab5 100644 --- a/engine/src/main/battlecode/common/RobotType.java +++ b/engine/src/main/battlecode/common/RobotType.java @@ -1,7 +1,11 @@ package battlecode.common; /** - * Contains details on various attributes of the different robots. All of this information is in the specs in a more organized form. + * Enumerates the possible types of robots. More information about the + * capabilities of each robot type are available in the game specs. + * + * You can check the type of another robot by inspecting {@link RobotInfo#type}, + * or your own type by inspecting {@link RobotController#getType}. */ public enum RobotType { @@ -9,81 +13,103 @@ public enum RobotType { // Health (level 1), Damage (level 1), Action Radius (squared), Vision Radius (squared), Bytecode Limit /** - * Archons are portable buildings that heal and generate robots. - * Losing all archons means losing the game. + * Archons are the headquarters of your army. They are Buildings that can + * build and repair Droids. * - * @battlecode.doc.robot */ + * @battlecode.doc.robottype + */ ARCHON ( 0, 250, 10, 24, 1000, -2, 20, 34, 20000), // BCL BCG AC MC HP DMG AR VR BL /** - * Alchemist's laboratory - * Converts lead into gold + * Laboratories house the magic of the alchemist. They are Buildings that + * can transmute lead into gold. * - * @battlecode.doc.robot */ + * @battlecode.doc.robottype + */ LABORATORY (800, 0, 10, 24, 100, 0, 0, 53, 5000), // BCL BCG AC MC HP DMG AR VR BL /** - * Guard turret - */ + * Watchtowers are defensive strongholds. They are Buildings that can + * attack robots that stray too close. + * + * @battlecode.doc.robottype + */ WATCHTOWER (180, 0, 10, 24, 130, 5, 20, 34, 10000), // BCL BCG AC MC HP DMG AR VR BL /** - * Can mine gold or lead at their or an adjacent location. + * Miners are resource-collecting robots. They are Droids that can mine lead + * or gold at their or an adjacent location. * - * @battlecode.doc.robot */ + * @battlecode.doc.robottype + */ MINER ( 50, 0, 2, 20, 40, 0, 2, 20, 7500), // BCL BCG AC MC HP DMG AR VR BL + /** - * Can build and repair buildings. + * Builders are resource-spending robots. They are Droids that can build, + * repair and mutate Buildings. * - * @battlecode.doc.robot */ + * @battlecode.doc.robottype + */ BUILDER ( 40, 0, 10, 20, 30, -1, 5, 20, 7500), // BCL BCG AC MC HP DMG AR VR BL - + /** - * Ranged attacking robot. - */ + * Soldiers are general-purpose attacking robots. They are Droids that can + * attack robots within a range. + * + * @battlecode.doc.robottype + */ SOLDIER ( 75, 0, 10, 16, 50, 3, 13, 20, 10000), // BCL BCG AC MC HP DMG AR VR BL - + /** - * Gold robot, causes Anomalies. + * Sages are wise robots with extraordinary abilities. They are Droids + * fashioned out of pure gold, able to envision Anomalies to the detriment + * of the enemy. + * + * @battlecode.doc.robottype */ SAGE ( 0, 50, 200, 25, 100, 45, 13, 20, 10000) // BCL BCG AC MC HP DMG AR VR BL ; /** - * Lead cost to build a given robot or building + * Lead cost to build a given robot or building. */ public final int buildCostLead; /** - * Gold cost to build a given robot or building (except for Archon's) + * Gold cost to build a given robot or building. */ public final int buildCostGold; /** - * Action cooldown. + * The action cooldown applied to the robot per action. */ public final int actionCooldown; /** - * Movement cooldown. + * The movement cooldown applied to the robot per move. */ public final int movementCooldown; /** - * Initial health per robot for Level 1. - */ + * The maximum health for a Level 1 robot of this type. + * + * @see #getMaxHealth + */ public final int health; /** - * Damage for each robot in Level 1. - */ + * The damage per attack for a Level 1 robot of this type. This value is + * negative for robots with repairing abilities. + * + * @see #getDamage + */ public final int damage; /** @@ -98,27 +124,17 @@ public enum RobotType { public final int visionRadiusSquared; /** - * Base bytecode limit of this robot + * Base bytecode limit of this robot. */ public final int bytecodeLimit; /** - * @return the squared action radius - */ - public int getActionRadiusSquared(int level) { - return this.actionRadiusSquared; - } - - /** - * @return the squared vision radius - */ - public int getVisionRadiusSquared(int level) { - return this.visionRadiusSquared; - } - - /** + * Returns whether this type can build a robot of another given type. + * * @param builtType type of robot being built * @return whether this type can build the given robot type + * + * @battlecode.doc.costlymethod */ public boolean canBuild(RobotType builtType) { return (this == ARCHON && (builtType == MINER || @@ -130,7 +146,10 @@ public boolean canBuild(RobotType builtType) { } /** + * Returns whether this type can attack. + * * @return whether this type can attack + * @battlecode.doc.costlymethod */ public boolean canAttack() { return (this == WATCHTOWER @@ -139,15 +158,22 @@ public boolean canAttack() { } /** - * @return whether this type can envision anomalies + * Returns whether this type can envision Anomalies. + * + * @return whether this type can envision Anomalies + * @battlecode.doc.costlymethod */ public boolean canEnvision() { return this == SAGE; } /** + * Returns whether this type can repair another robot of a given type. + * * @param repairedType type of robot being repaired * @return whether this type can repair the given robot type + * + * @battlecode.doc.costlymethod */ public boolean canRepair(RobotType repairedType) { return ((this == ARCHON && !repairedType.isBuilding()) || @@ -155,30 +181,43 @@ public boolean canRepair(RobotType repairedType) { } /** - * @return whether this type can mine + * Returns whether this type can mine for metal. + * + * @return whether this type can mine for metal + * @battlecode.doc.costlymethod */ public boolean canMine() { return this == MINER; } /** + * Returns whether this type can mutate another robot of a given type. + * * @param mutatedType type of robot being mutated - * @return whether this type can mutate buildings + * @return whether this type can mutate another robot of a given type + * + * @battlecode.doc.costlymethod */ public boolean canMutate(RobotType mutatedType) { return this == BUILDER && mutatedType.isBuilding(); } /** + * Returns whether this type can transmute lead into gold. + * * @return whether this type can transmute lead into gold + * @battlecode.doc.costlymethod */ public boolean canTransmute() { return this == LABORATORY; } /** - * @return whether or not a given robot is a building - */ + * Returns whether or not a given robot is a Building. + * + * @return whether or not a given robot is a Building + * @battlecode.doc.costlymethod + */ public boolean isBuilding() { return ( this == ARCHON @@ -189,8 +228,11 @@ public boolean isBuilding() { /** * Returns the max health of a robot by level. + * * @param level of the robot * @return the max health of a robot by level + * + * @battlecode.doc.costlymethod */ public int getMaxHealth(int level) { if (!this.isBuilding() || level == 1) { @@ -205,9 +247,12 @@ public int getMaxHealth(int level) { } /** - * Returns the damage of a robot by level. - * @param level - * @return the damage for a robot by level, negative if robot heals + * Determine the damage power of a robot by level. + * + * @param level The specific level of the robot. + * @return the damage for a robot by level, negative if robot repairs + * + * @battlecode.doc.costlymethod */ public int getDamage(int level) { if (!this.isBuilding() || level == 1) { @@ -222,9 +267,13 @@ public int getDamage(int level) { } /** - * @param level - * @return the healing per turn for a robot by level as a positive amount, - * 0 if robot doesn't heal + * Determine the repairing power of a robot by level. + * + * @param level The specific level of the robot. + * @return the repair per turn for a robot by level as a positive amount, + * or 0 if robot doesn't repair + * + * @battlecode.doc.costlymethod */ public int getHealing(int level) { if (this == ARCHON || this == BUILDER) { @@ -237,24 +286,36 @@ public int getHealing(int level) { // COST RELATED FUNCTIONS /** + * Determine the lead cost of Mutating this robot to a specific level. + * * @param level the level to mutate to - * @return lead component of cost to mutate + * @return lead cost to mutate, unspecified if mutation is invalid + * + * @battlecode.doc.costlymethod */ public int getLeadMutateCost(int level) { return level == 2 ? 600 : 0; } /** + * Determine the gold cost of Mutating this robot to a specific level. + * * @param level the level to mutate to - * @return gold component of cost to mutate. + * @return gold cost to mutate, unspecified if mutation is invalid + * + * @battlecode.doc.costlymethod */ public int getGoldMutateCost(int level) { return level == 3 ? 100 : 0; } /** + * Determine the robot's net worth in lead. + * * @param level the robot's current level * @return lead component of worth + * + * @battlecode.doc.costlymethod */ public int getLeadWorth(int level) { int leadWorth = this.buildCostLead; @@ -265,8 +326,12 @@ public int getLeadWorth(int level) { } /** + * Determine the robot's net worth in gold. + * * @param level the robot's current level * @return gold component of worth + * + * @battlecode.doc.costlymethod */ public int getGoldWorth(int level) { int goldWorth = this.buildCostGold; @@ -277,16 +342,24 @@ public int getGoldWorth(int level) { } /** + * Determine the amount of lead dropped if this robot dies. + * * @param level the robot's current level * @return the amount of lead dropped + * + * @battlecode.doc.costlymethod */ public int getLeadDropped(int level) { return (int) (this.getLeadWorth(level) * GameConstants.RECLAIM_COST_MULTIPLIER); } /** + * Determine the amount of gold dropped if this robot dies. + * * @param level the robot's current level * @return the amount of gold dropped + * + * @battlecode.doc.costlymethod */ public int getGoldDropped(int level) { return (int) (this.getGoldWorth(level) * GameConstants.RECLAIM_COST_MULTIPLIER); diff --git a/engine/src/main/battlecode/instrumenter/bytecode/resources/MethodCosts.txt b/engine/src/main/battlecode/instrumenter/bytecode/resources/MethodCosts.txt index df2611d9..74c6406b 100644 --- a/engine/src/main/battlecode/instrumenter/bytecode/resources/MethodCosts.txt +++ b/engine/src/main/battlecode/instrumenter/bytecode/resources/MethodCosts.txt @@ -1,72 +1,110 @@ -battlecode/common/Clock/yield 0 true -battlecode/common/Clock/getBytecodesLeft 0 true -battlecode/common/Clock/getBytecodeNum 0 true -battlecode/common/Direction/equals 1 false -battlecode/common/Direction/getDeltaX 1 false -battlecode/common/Direction/getDeltaY 1 false -battlecode/common/Direction/rotateLeft 1 false -battlecode/common/Direction/rotateRight 1 false -battlecode/common/Direction/opposite 1 false -battlecode/common/Direction/allDirections 1 false -battlecode/common/Direction/cardinalDirections 1 false -battlecode/common/MapLocation/add 2 false -battlecode/common/MapLocation/compareTo 2 false -battlecode/common/MapLocation/directionTo 2 false -battlecode/common/MapLocation/distanceSquaredTo 2 false -battlecode/common/MapLocation/equals 2 false -battlecode/common/MapLocation/hashCode 2 false -battlecode/common/MapLocation/isWithinDistanceSquared 2 false -battlecode/common/MapLocation/isAdjacentTo 2 false -battlecode/common/MapLocation/isWithinSensorRadius 2 false -battlecode/common/MapLocation/subtract 2 false -battlecode/common/MapLocation/toString 2 false -battlecode/common/MapLocation/translate 2 false -battlecode/common/MapLocation/valueOf 25 false -battlecode/common/RobotController/adjacentLocation 1 true -battlecode/common/RobotController/bid 1 true -battlecode/common/RobotController/buildRobot 0 true -battlecode/common/RobotController/canBid 10 true -battlecode/common/RobotController/canBuildRobot 10 true -battlecode/common/RobotController/canDetectLocation 5 true -battlecode/common/RobotController/canDetectRadiusSquared 5 true -battlecode/common/RobotController/canEmpower 10 true -battlecode/common/RobotController/canExpose 10 true -battlecode/common/RobotController/canGetFlag 5 true -battlecode/common/RobotController/canMove 10 true -battlecode/common/RobotController/canSenseLocation 5 true -battlecode/common/RobotController/canSenseRadiusSquared 5 true -battlecode/common/RobotController/canSenseRobot 5 true -battlecode/common/RobotController/detectNearbyRobots 100 true -battlecode/common/RobotController/empower 0 true -battlecode/common/RobotController/expose 0 true -battlecode/common/RobotController/getConviction 1 true -battlecode/common/RobotController/getCooldownTurns 1 true -battlecode/common/RobotController/getEmpowerFactor 1 true -battlecode/common/RobotController/getFlag 5 true -battlecode/common/RobotController/getID 1 true -battlecode/common/RobotController/getInfluence 1 true -battlecode/common/RobotController/getLocation 1 true -battlecode/common/RobotController/getRobotCount 20 true -battlecode/common/RobotController/getRoundNum 1 true -battlecode/common/RobotController/getTeam 1 true -battlecode/common/RobotController/getTeamVotes 1 true -battlecode/common/RobotController/getType 1 true -battlecode/common/RobotController/isLocationOccupied 20 true -battlecode/common/RobotController/isReady 1 true -battlecode/common/RobotController/move 0 true -battlecode/common/RobotController/onTheMap 5 true -battlecode/common/RobotController/resign 0 true -battlecode/common/RobotController/senseNearbyRobots 100 true -battlecode/common/RobotController/sensePassability 1 true -battlecode/common/RobotController/senseRobot 25 true -battlecode/common/RobotController/senseRobotAtLocation 25 true -battlecode/common/RobotController/setFlag 100 true -battlecode/common/RobotController/setIndicatorDot 0 true -battlecode/common/RobotController/setIndicatorLine 0 true -battlecode/common/RobotType/getInfluenceCostForConviction 1 false -battlecode/common/RobotType/getPassiveInfluence 1 false -battlecode/common/Team/opponent 1 false -battlecode/common/Team/isPlayer 1 false +battlecode/common/AnomalyScheduleEntry/equals 2 false +battlecode/common/Clock/yield 0 true +battlecode/common/Clock/getBytecodesLeft 0 false +battlecode/common/Clock/getBytecodeNum 0 false +battlecode/common/Direction/equals 1 false +battlecode/common/Direction/getDeltaX 1 false +battlecode/common/Direction/getDeltaY 1 false +battlecode/common/Direction/rotateLeft 1 false +battlecode/common/Direction/rotateRight 1 false +battlecode/common/Direction/opposite 1 false +battlecode/common/Direction/allDirections 1 false +battlecode/common/Direction/cardinalDirections 1 false +battlecode/common/MapLocation/add 2 false +battlecode/common/MapLocation/compareTo 2 false +battlecode/common/MapLocation/directionTo 2 false +battlecode/common/MapLocation/distanceSquaredTo 2 false +battlecode/common/MapLocation/equals 2 false +battlecode/common/MapLocation/hashCode 2 false +battlecode/common/MapLocation/isWithinDistanceSquared 2 false +battlecode/common/MapLocation/isAdjacentTo 2 false +battlecode/common/MapLocation/isWithinSensorRadius 2 false +battlecode/common/MapLocation/subtract 2 false +battlecode/common/MapLocation/toString 2 false +battlecode/common/MapLocation/translate 2 false +battlecode/common/MapLocation/valueOf 25 false +battlecode/common/RobotController/adjacentLocation 1 true +battlecode/common/RobotController/attack 0 true +battlecode/common/RobotController/buildRobot 0 true +battlecode/common/RobotController/canAttack 10 true +battlecode/common/RobotController/canBuildRobot 10 true +battlecode/common/RobotController/canEnvision 10 true +battlecode/common/RobotController/canMineGold 10 true +battlecode/common/RobotController/canMineLead 10 true +battlecode/common/RobotController/canMove 10 true +battlecode/common/RobotController/canMutate 10 true +battlecode/common/RobotController/canRepair 10 true +battlecode/common/RobotController/canSenseLocation 5 true +battlecode/common/RobotController/canSenseRadiusSquared 5 true +battlecode/common/RobotController/canSenseRobot 5 true +battlecode/common/RobotController/canSenseRobotAtLocation 5 true +battlecode/common/RobotController/canTransform 10 true +battlecode/common/RobotController/canTransmute 10 true +battlecode/common/RobotController/disintegrate 0 true +battlecode/common/RobotController/envision 0 true +battlecode/common/RobotController/getActionCooldownTurns 1 true +battlecode/common/RobotController/getAllLocationsWithinRadiusSquared 100 true +battlecode/common/RobotController/getAnomalySchedule 100 true +battlecode/common/RobotController/getArchonCount 20 true +battlecode/common/RobotController/getHealth 1 true +battlecode/common/RobotController/getID 1 true +battlecode/common/RobotController/getLevel 1 true +battlecode/common/RobotController/getLocation 1 true +battlecode/common/RobotController/getMapHeight 1 true +battlecode/common/RobotController/getMapWidth 1 true +battlecode/common/RobotController/getMode 1 true +battlecode/common/RobotController/getMovementCooldownTurns 1 true +battlecode/common/RobotController/getRobotCount 20 true +battlecode/common/RobotController/getRoundNum 1 true +battlecode/common/RobotController/getTeam 1 true +battlecode/common/RobotController/getTeamGoldAmount 1 true +battlecode/common/RobotController/getTeamLeadAmount 1 true +battlecode/common/RobotController/getTransformCooldownTurns 1 true +battlecode/common/RobotController/getTransmutationRate 20 true +battlecode/common/RobotController/getType 1 true +battlecode/common/RobotController/isActionReady 1 true +battlecode/common/RobotController/isLocationOccupied 20 true +battlecode/common/RobotController/isMovementReady 1 true +battlecode/common/RobotController/isTransformReady 1 true +battlecode/common/RobotController/mineGold 0 true +battlecode/common/RobotController/mineLead 0 true +battlecode/common/RobotController/move 0 true +battlecode/common/RobotController/mutate 0 true +battlecode/common/RobotController/onTheMap 5 true +battlecode/common/RobotController/readSharedArray 2 true +battlecode/common/RobotController/repair 0 true +battlecode/common/RobotController/resign 0 true +battlecode/common/RobotController/senseGold 5 true +battlecode/common/RobotController/senseLead 5 true +battlecode/common/RobotController/senseNearbyRobots 100 true +battlecode/common/RobotController/senseRobot 25 true +battlecode/common/RobotController/senseRobotAtLocation 25 true +battlecode/common/RobotController/senseRubble 5 true +battlecode/common/RobotController/setIndicatorDot 0 true +battlecode/common/RobotController/setIndicatorLine 0 true +battlecode/common/RobotController/setIndicatorString 0 true +battlecode/common/RobotController/transform 0 true +battlecode/common/RobotController/transmute 0 true +battlecode/common/RobotController/writeSharedArray 100 true +battlecode/common/RobotType/canAttack 1 false +battlecode/common/RobotType/canBuild 1 false +battlecode/common/RobotType/canEnvision 1 false +battlecode/common/RobotType/canMine 1 false +battlecode/common/RobotType/canMutate 1 false +battlecode/common/RobotType/canRepair 1 false +battlecode/common/RobotType/canTransmute 1 false +battlecode/common/RobotType/getDamage 1 false +battlecode/common/RobotType/getGoldDropped 1 false +battlecode/common/RobotType/getGoldMutateCost 1 false +battlecode/common/RobotType/getGoldWorth 1 false +battlecode/common/RobotType/getHealing 1 false +battlecode/common/RobotType/getLeadDropped 1 false +battlecode/common/RobotType/getLeadMutateCost 1 false +battlecode/common/RobotType/getLeadWorth 1 false +battlecode/common/RobotType/getMaxHealth 1 false +battlecode/common/RobotType/isBuilding 1 false +battlecode/common/Team/opponent 1 false +battlecode/common/Team/isPlayer 1 false java/lang/Math/IEEEremainder 1 false java/lang/Math/abs 1 false java/lang/Math/acos 1 false diff --git a/engine/src/main/battlecode/world/GameWorld.java b/engine/src/main/battlecode/world/GameWorld.java index 385a95b3..1402580e 100644 --- a/engine/src/main/battlecode/world/GameWorld.java +++ b/engine/src/main/battlecode/world/GameWorld.java @@ -515,7 +515,7 @@ public void setProfilerCollection(Team team, ProfilerCollection profilerCollecti private MapLocation[] getSageActionLocations(InternalRobot robot) { assert robot.getType() == RobotType.SAGE; MapLocation center = robot.getLocation(); - return getAllLocationsWithinRadiusSquared(center, robot.getType().getActionRadiusSquared(robot.getLevel())); + return getAllLocationsWithinRadiusSquared(center, robot.getType().actionRadiusSquared); } /** diff --git a/engine/src/main/battlecode/world/MapBuilder.java b/engine/src/main/battlecode/world/MapBuilder.java index 6ea6b203..838cc880 100644 --- a/engine/src/main/battlecode/world/MapBuilder.java +++ b/engine/src/main/battlecode/world/MapBuilder.java @@ -238,7 +238,7 @@ public void assertIsValid() { this.width, this.height, r.getLocation(), - r.getType().getVisionRadiusSquared(1) + r.getType().visionRadiusSquared ); for (MapLocation location : visibleLocations) diff --git a/gradle.properties b/gradle.properties index 3d94d4be..77abe11d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ maps=maptestsmall profilerEnabled=false source=src mapLocation=maps -release_version=2022.0.0.0 +release_version=2022.0.0.1