Skip to content

Commit 3fb929a

Browse files
authored
Merge pull request #32 from battlecode/javadocs
Add javadocs and bytecode costs
2 parents 990687c + 4515250 commit 3fb929a

File tree

17 files changed

+440
-218
lines changed

17 files changed

+440
-218
lines changed

build.gradle

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,6 @@ task releaseClientLinux32(type: Zip, dependsOn: ['prodClient']) {
272272

273273

274274

275-
task updateVersion() {
276-
// new File("frontend/public/version.txt").write(project.findProperty('release_version'))
277-
}
278-
279-
280-
281-
publish.dependsOn(updateVersion)
282275
publishing {
283276
repositories {
284277
maven {
@@ -296,11 +289,10 @@ publishing {
296289
publications {
297290
server(MavenPublication) {
298291
groupId 'org.battlecode'
299-
artifactId 'battlecode21'
292+
artifactId 'battlecode22'
300293
version project.findProperty('release_version') ?: 'NONSENSE'
301294

302295
artifact release_main
303-
304296

305297
artifact release_docs {
306298
classifier 'javadoc'
@@ -312,39 +304,39 @@ publishing {
312304

313305
clientWin(MavenPublication) {
314306
groupId 'org.battlecode'
315-
artifactId 'battlecode21-client-win'
307+
artifactId 'battlecode22-client-win'
316308
version project.findProperty('release_version') ?: 'NONSENSE'
317309

318310
artifact releaseClientWin
319311
}
320312

321313
clientMac(MavenPublication) {
322314
groupId 'org.battlecode'
323-
artifactId 'battlecode21-client-mac'
315+
artifactId 'battlecode22-client-mac'
324316
version project.findProperty('release_version') ?: 'NONSENSE'
325317

326318
artifact releaseClientMac
327319
}
328320

329321
clientLinux(MavenPublication) {
330322
groupId 'org.battlecode'
331-
artifactId 'battlecode21-client-linux'
323+
artifactId 'battlecode22-client-linux'
332324
version project.findProperty('release_version') ?: 'NONSENSE'
333325

334326
artifact releaseClientLinux
335327
}
336328

337329
clientWin32(MavenPublication) {
338330
groupId 'org.battlecode'
339-
artifactId 'battlecode21-client-win-32'
331+
artifactId 'battlecode22-client-win-32'
340332
version project.findProperty('release_version') ?: 'NONSENSE'
341333

342334
artifact releaseClientWin32
343335
}
344336

345337
clientLinux32(MavenPublication) {
346338
groupId 'org.battlecode'
347-
artifactId 'battlecode21-client-linux-32'
339+
artifactId 'battlecode22-client-linux-32'
348340
version project.findProperty('release_version') ?: 'NONSENSE'
349341

350342
artifact releaseClientLinux32
Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,67 @@
11
package battlecode.common;
22

3+
/**
4+
* AnomalyScheduleEntry describes a single Anomaly in the Anomaly schedule. The
5+
* schedule of Anomalies is predetermined for each map, and you can retrieve it
6+
* by calling {@link RobotController#getAnomalySchedule}. Each schedule entry
7+
* provides information about the round on which it occurs, and the type of the
8+
* Anomaly.
9+
* <P>
10+
* Note that the Singularity is not included in the schedule. You should instead
11+
* check {@link GameConstants#GAME_MAX_NUMBER_OF_ROUNDS}.
12+
*/
313
public class AnomalyScheduleEntry {
4-
14+
/**
15+
* The round on which this Anomaly will occur. The Anomaly will occur at the
16+
* end of this round, that is, after all robots have taken their turn.
17+
*/
518
public final int roundNumber;
19+
20+
/**
21+
* The type of this Anomaly.
22+
*/
623
public final AnomalyType anomalyType;
724

8-
public AnomalyScheduleEntry(int round, AnomalyType anomaly) {
25+
/**
26+
* Constructs an AnomalyScheduleEntry using the given round number and
27+
* Anomaly type. Note that this does not actually insert the Anomaly into
28+
* the schedule, but only creates a local object that you are free to
29+
* manipulate. The global Anomaly schedule is fixed and cannot be changed;
30+
* to envision an Anomaly with a Sage, see {@link RobotController#envision}.
31+
*
32+
* @param round the round number of the Anomaly
33+
* @param type the type of the Anomaly
34+
*/
35+
public AnomalyScheduleEntry(int round, AnomalyType type) {
936
this.roundNumber = round;
10-
this.anomalyType = anomaly;
37+
this.anomalyType = type;
1138
}
1239

1340
/**
14-
* @return a copy of the entry
41+
* Constructs a copy of this schedule entry. Note that this does not
42+
* actually cause the Anomaly to happen twice, but only creates a local
43+
* object that you are free to manipulate. The global Anomaly schedule is
44+
* fixed and cannot be changed; to envision an Anomaly with a Sage, see
45+
* {@link RobotController#envision}.
46+
*
47+
* @return a copy of this AnomalyScheduleEntry
1548
*/
1649
public AnomalyScheduleEntry copyEntry() {
1750
return new AnomalyScheduleEntry(this.roundNumber, this.anomalyType);
1851
}
1952

2053
/**
21-
* Returns whether two AnomalyScheduleEntrys are equal.
54+
* Returns whether two AnomalyScheduleEntry objects are equivalent.
55+
*
56+
* @param other the AnomalyScheduleEntry to compare with
57+
* @return whether the two AnomalyScheduleEntry objects are equivalent
2258
*
23-
* @param other the other anomaly schedule entry to compare to
24-
* @return whether the two anomaly schedules entry are equivalent
59+
* @battlecode.doc.costlymethod
2560
*/
26-
public boolean equals(AnomalyScheduleEntry other) {
27-
if (this.roundNumber != other.roundNumber) return false;
28-
return this.anomalyType == other.anomalyType;
61+
@Override
62+
public boolean equals(Object other) {
63+
if (other == null || getClass() != other.getClass()) return false;
64+
AnomalyScheduleEntry casted = (AnomalyScheduleEntry) other;
65+
return this.roundNumber == casted.roundNumber && this.anomalyType == casted.anomalyType;
2966
}
3067
}
Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,74 @@
11
package battlecode.common;
22

33
/**
4-
* Holds the different anomalies in the game.
4+
* AnomalyType represents the type of a scheduled or envisioned Anomaly. You
5+
* can access the type of scheduled Anomalies from
6+
* {@link AnomalyScheduleEntry#anomalyType}, and envision your own Anomalies with
7+
* Sages by using {@link RobotController#envision}.
8+
* <P>
9+
* AnomalyType also provides information about the strenghts of each Anomaly, as
10+
* well as other properties.
11+
* <P>
12+
* Note that the Singularity is not included in the schedule. You should instead
13+
* check {@link GameConstants#GAME_MAX_NUMBER_OF_ROUNDS}.
514
*/
615
public enum AnomalyType {
16+
/**
17+
* Abyss causes proportional amounts of metal resources to be lost. When
18+
* global, the entire map as well as team reserves are affected. When
19+
* envisioned, a local region of the map is affected.
20+
* <P>
21+
* {@link #globalPercentage} and {@link #sagePercentage} specify the
22+
* proportion of metals lost.
23+
*/
724
ABYSS (true, true, 0.1f, 0.2f),
25+
26+
/**
27+
* Charge deals concentrated damage to Droids. When global, the top
28+
* {@link #globalPercentage} Droids with the most nearby friendly units are
29+
* destroyed. When envisioned, all nearby enemy Droids lose
30+
* {@link #sagePercentage} of their maximum health.
31+
*/
832
CHARGE (true, true, 0.05f, 0.1f),
33+
34+
/**
35+
* Fury deals concentrated proportional damage to Turrets. When global, all
36+
* Turrets are affected. When envisioned, a local region is affected.
37+
* <P>
38+
* {@link #globalPercentage} and {@link #sagePercentage} specify the
39+
* amount of damage dealt, as a proportion of the Turret's maximum health.
40+
*/
941
FURY (true, true, 0.05f, 0.1f),
42+
43+
/**
44+
* Vortex upends the world by transforming the map terrain. It can only
45+
* occur globally.
46+
* <P>
47+
* The values of {@link #globalPercentage} and {@link #sagePercentage} are
48+
* unused.
49+
*/
1050
VORTEX (true, false, 0, 0);
11-
51+
52+
/**
53+
* Whether this type of Anomaly could appear in the global schedule.
54+
*/
1255
public final boolean isGlobalAnomaly;
56+
57+
/**
58+
* Whether this type of Anomaly could be envisioned by Sages.
59+
*/
1360
public final boolean isSageAnomaly;
61+
62+
/**
63+
* The strength of this Anomaly when globally scheduled. The precise
64+
* definition of this value depends on the Anomaly type.
65+
*/
1466
public final float globalPercentage;
67+
68+
/**
69+
* The strength of this Anomaly when envisioned by a Sage. The precise
70+
* definition of this value depends on the Anomaly type.
71+
*/
1572
public final float sagePercentage;
1673

1774
AnomalyType(boolean isGlobalAnomaly, boolean isSageAnomaly, float globalPercentage, float sagePercentage) {
@@ -20,4 +77,4 @@ public enum AnomalyType {
2077
this.globalPercentage = globalPercentage;
2178
this.sagePercentage = sagePercentage;
2279
}
23-
}
80+
}

engine/src/main/battlecode/common/BodyInfo.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

engine/src/main/battlecode/common/Clock.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
import battlecode.instrumenter.inject.RobotMonitor;
44

55
/**
6-
* Clock is a singleton that allows contestants to introspect the state of their running
7-
* code.
6+
* Clock is a singleton that allows contestants to introspect the state of their
7+
* running code.
88
*
99
* @author james
1010
*/
1111
@SuppressWarnings("unused")
1212
public final class Clock {
13-
14-
/**
13+
/*
1514
* IMPORTANT NOTE!
1615
* This class is reloaded for every individual robot.
1716
* See Loader for more information.
@@ -28,20 +27,20 @@ public static void yield() {
2827

2928
/**
3029
* Returns the number of bytecodes this robot has left in this round.
31-
* @return the number of bytecodes this robot has left in this round.
3230
*
31+
* @return the number of bytecodes this robot has left in this round
3332
* @battlecode.doc.costlymethod
3433
*/
3534
public static int getBytecodesLeft() {
3635
return RobotMonitor.getBytecodesLeft();
3736
}
3837

3938
/**
40-
* Returns the number of bytecodes the current robot has executed since the beginning
41-
* of the current round.
42-
* @return the number of bytecodes the current robot has executed since the beginning
43-
* of the current round.
39+
* Returns the number of bytecodes the current robot has executed since the
40+
* beginning of the current round.
4441
*
42+
* @return the number of bytecodes the current robot has executed since the
43+
* beginning of the current round
4544
* @battlecode.doc.costlymethod
4645
*/
4746
public static int getBytecodeNum() {

engine/src/main/battlecode/common/Direction.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ public enum Direction {
5050
CENTER(0, 0);
5151

5252
/**
53-
* Change in x, change in y.
53+
* Change in x.
5454
*/
55-
public final int dx, dy;
55+
public final int dx;
56+
57+
/**
58+
* Change in y.
59+
*/
60+
public final int dy;
5661

5762
Direction(int dx, int dy) {
5863
this.dx = dx;
@@ -102,9 +107,9 @@ public Direction rotateRight() {
102107

103108
/**
104109
* Returns a list of all directions. This is equivalent to calling
105-
* Direction.values().
110+
* {@link Direction#values}.
106111
*
107-
* @return array of all directions.
112+
* @return array of all directions
108113
*/
109114
public static Direction[] allDirections() {
110115
return Direction.values();
@@ -113,7 +118,7 @@ public static Direction[] allDirections() {
113118
/**
114119
* Returns a list of all cardinal directions.
115120
*
116-
* @return array of all cardinal directions.
121+
* @return array of all cardinal directions
117122
*/
118123
public static Direction[] cardinalDirections() {
119124
return new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST};
@@ -122,7 +127,7 @@ public static Direction[] cardinalDirections() {
122127
/**
123128
* Returns the delta X of the direction.
124129
*
125-
* @return the delta X of the direction.
130+
* @return the delta X of the direction
126131
*/
127132
public int getDeltaX() {
128133
return this.dx;
@@ -131,9 +136,9 @@ public int getDeltaX() {
131136
/**
132137
* Returns the delta Y of the direction.
133138
*
134-
* @return the delta Y of the direction.
139+
* @return the delta Y of the direction
135140
*/
136141
public int getDeltaY() {
137142
return this.dy;
138143
}
139-
}
144+
}

engine/src/main/battlecode/common/GameActionException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public GameActionException(GameActionExceptionType type, String message) {
3535
* Gives the type of gameworld interaction that caused this GameActionException, which
3636
* was specified when this instance was constructed.
3737
*
38-
* @return this GameActionException's type.
38+
* @return this GameActionException's type
3939
*/
4040
public GameActionExceptionType getType() {
4141
return type;

0 commit comments

Comments
 (0)