Skip to content

Commit 727da7e

Browse files
committed
change buildRobot to buildRat
1 parent 58bded4 commit 727da7e

5 files changed

Lines changed: 23 additions & 23 deletions

File tree

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -608,25 +608,25 @@ public interface RobotController {
608608
int getCurrentRatCost();
609609

610610
/**
611-
* Checks if a rat king can spawn a robot at the given location.
612-
* Robots can spawn within a circle of radius of sqrt(4) of the rat king.
611+
* Checks if a rat king can spawn a baby rat at the given location.
612+
* Rats can spawn within a circle of radius of sqrt(4) of the rat king.
613613
*
614-
* @param loc the location to spawn the robot at
615-
* @return true if robot can be built at loc
614+
* @param loc the location to spawn the rat at
615+
* @return true if rat can be built at loc
616616
*
617617
* @battlecode.doc.costlymethod
618618
*/
619-
boolean canBuildRobot(MapLocation loc);
619+
boolean canBuildRat(MapLocation loc);
620620

621621
/**
622-
* Spawns a robot at the given location.
623-
* Robots can spawn within a circle of radius of sqrt(4) of the rat king.
622+
* Spawns a baby rat at the given location.
623+
* Rats can spawn within a circle of radius of sqrt(4) of the rat king.
624624
*
625-
* @param loc the location to spawn the robot at
625+
* @param loc the location to spawn the rat at
626626
*
627627
* @battlecode.doc.costlymethod
628628
*/
629-
void buildRobot(MapLocation loc) throws GameActionException;
629+
void buildRat(MapLocation loc) throws GameActionException;
630630

631631
/**
632632
* Checks if a rat can become a rat king, when 7 allied rats are in the 3x3

engine/src/main/battlecode/instrumenter/bytecode/resources/MethodCosts.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ battlecode/common/RobotController/move 1 tru
7070
battlecode/common/RobotController/canTurn 1 true
7171
battlecode/common/RobotController/turn 1 true
7272
battlecode/common/RobotController/getCurrentRatCost 1 true
73-
battlecode/common/RobotController/canBuildRobot 10 true
74-
battlecode/common/RobotController/buildRobot 20 true
73+
battlecode/common/RobotController/canBuildRat 10 true
74+
battlecode/common/RobotController/buildRat 20 true
7575
battlecode/common/RobotController/canBecomeRatKing 10 true
7676
battlecode/common/RobotController/becomeRatKing 20 true
7777
battlecode/common/RobotController/canPlaceDirt 5 true
@@ -126,7 +126,7 @@ battlecode/common/RobotInfo/getDirection 2 fal
126126
battlecode/common/RobotInfo/getChirality 1 false
127127
battlecode/common/RobotInfo/getType 1 false
128128
battlecode/common/RobotInfo/getRawCheeseAmount 2 false
129-
battlecode/common/RobotInfo/getCarryingRobot 2 false
129+
battlecode/common/RobotInfo/getCarrying 2 false
130130
battlecode/common/RobotInfo/equals 15 false
131131
battlecode/common/RobotInfo/hashCode 15 false
132132
battlecode/common/RobotInfo/toString 15 false

engine/src/main/battlecode/world/RobotControllerImpl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -866,41 +866,41 @@ private void assertIsRobotType(UnitType type) throws GameActionException {
866866
}
867867
}
868868

869-
private void assertCanBuildRobot(MapLocation loc) throws GameActionException {
869+
private void assertCanBuildRat(MapLocation loc) throws GameActionException {
870870
assertNotNull(loc);
871871
assertCanActLocation(loc, GameConstants.BUILD_ROBOT_RADIUS_SQUARED);
872872
assertIsActionReady();
873873
if (!this.robot.getType().isRatKingType()) {
874-
throw new GameActionException(CANT_DO_THAT, "Only rat kings can spawn other robots!");
874+
throw new GameActionException(CANT_DO_THAT, "Only rat kings can spawn other rats!");
875875
}
876876
int cost = getCurrentRatCost();
877877

878878
if (this.gameWorld.getTeamInfo().getCheese(this.robot.getTeam()) < cost) {
879-
throw new GameActionException(CANT_DO_THAT, "Not enough cheese to build new robot!");
879+
throw new GameActionException(CANT_DO_THAT, "Not enough cheese to build new rat!");
880880
}
881881

882882
if (isLocationOccupied(loc)) {
883883
throw new GameActionException(CANT_DO_THAT, "Location is already occupied!");
884884
}
885885

886886
if (!sensePassability(loc)) {
887-
throw new GameActionException(CANT_DO_THAT, "Location has a wall or ruin!");
887+
throw new GameActionException(CANT_DO_THAT, "Location has dirt or a wall!");
888888
}
889889
}
890890

891891
@Override
892-
public boolean canBuildRobot(MapLocation loc) {
892+
public boolean canBuildRat(MapLocation loc) {
893893
try {
894-
assertCanBuildRobot(loc);
894+
assertCanBuildRat(loc);
895895
return true;
896896
} catch (GameActionException e) {
897897
return false;
898898
}
899899
}
900900

901901
@Override
902-
public void buildRobot(MapLocation loc) throws GameActionException {
903-
assertCanBuildRobot(loc);
902+
public void buildRat(MapLocation loc) throws GameActionException {
903+
assertCanBuildRat(loc);
904904
this.robot.addActionCooldownTurns(GameConstants.BUILD_ROBOT_COOLDOWN);
905905
this.gameWorld.spawnRobot(UnitType.BABY_RAT, loc, this.getDirection(), this.robot.getChirality(),
906906
this.robot.getTeam());

example-bots/src/main/colemanplayerv0v1/RobotPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public static void runKing(RobotController rc) throws GameActionException {
144144
.println("Turn " + turnCount + "SPAWNING RAT at location " + rc.getLocation() + " with cheese " + cheese);
145145
Direction dir = rc.getLocation().directionTo(new MapLocation(rc.getMapWidth() / 2, rc.getMapHeight() / 2));
146146
MapLocation loc = rc.getLocation().add(dir).add(dir);
147-
rc.buildRobot(loc);
147+
rc.buildRat(loc);
148148
commToNewRat(rc, loc);
149149
} else {
150150
// TODO System.out.println("Turn " + turnCount + " NOT ENOUGH CHEESE to spawn RAT at location " + rc.getLocation() + " with cheese "+ cheese);

example-bots/src/main/ruthplayer/RobotPlayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ public static void runRatKing(RobotController rc) throws GameActionException {
139139
MapLocation randomLocation = rc.getLocation().add(directions[randomDirection])
140140
.add(directions[randomDirection]);
141141

142-
if (rc.canBuildRobot(randomLocation)) {
143-
rc.buildRobot(randomLocation);
142+
if (rc.canBuildRat(randomLocation)) {
143+
rc.buildRat(randomLocation);
144144
}
145145
}
146146

0 commit comments

Comments
 (0)