Skip to content

Commit

Permalink
Merge pull request #50 from battlecode/engine-patches
Browse files Browse the repository at this point in the history
fix sense lead/gold
  • Loading branch information
j-mao authored Jan 12, 2022
2 parents d3489de + 5c3b5dd commit 003c07f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions engine/src/main/battlecode/world/RobotControllerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ public MapLocation[] senseNearbyLocationsWithLead(MapLocation center, int radius
throw new GameActionException(CANT_DO_THAT,
"Radius squared must be non-negative.");
ArrayList<MapLocation> locations = new ArrayList<>();
for (MapLocation m : this.gameWorld.getAllLocationsWithinRadiusSquared(center, radiusSquared)) {
if (this.gameWorld.getLead(m) >= minLead) {
locations.add(m);
for (MapLocation loc : this.gameWorld.getAllLocationsWithinRadiusSquared(center, radiusSquared)) {
if (this.gameWorld.getLead(loc) >= minLead && canSenseLocation(loc)) {
locations.add(loc);
}
}
MapLocation[] result = new MapLocation[locations.size()];
Expand Down Expand Up @@ -361,9 +361,9 @@ public MapLocation[] senseNearbyLocationsWithGold(MapLocation center, int radius
throw new GameActionException(CANT_DO_THAT,
"Radius squared must be non-negative.");
ArrayList<MapLocation> locations = new ArrayList<>();
for (MapLocation m : this.gameWorld.getAllLocationsWithinRadiusSquared(center, radiusSquared)) {
if (this.gameWorld.getGold(m) >= minGold) {
locations.add(m);
for (MapLocation loc : this.gameWorld.getAllLocationsWithinRadiusSquared(center, radiusSquared)) {
if (this.gameWorld.getGold(loc) >= minGold && canSenseLocation(loc)) {
locations.add(loc);
}
}
MapLocation[] result = new MapLocation[locations.size()];
Expand Down

0 comments on commit 003c07f

Please sign in to comment.