Skip to content

Commit 59d6149

Browse files
committed
get number cat and rat traps
1 parent 51dcb81 commit 59d6149

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@ public interface RobotController {
6262
*/
6363
Team getBackstabbingTeam();
6464

65+
/**
66+
* Returns the number of active cat traps for the team.
67+
*
68+
* @return the number of active cat traps this team has.
69+
*
70+
* @battlecode.doc.costlymethod
71+
*/
72+
int getNumberCatTraps();
73+
74+
/**
75+
* Returns the number of active rat traps for the team.
76+
*
77+
* @return the number of active rat traps this team has.
78+
*
79+
* @battlecode.doc.costlymethod
80+
*/
81+
int getNumberRatTraps();
82+
6583
// *********************************
6684
// ****** UNIT QUERY METHODS *******
6785
// *********************************

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ public int getDirt() {
165165
return this.gameWorld.getTeamInfo().getDirt(getTeam());
166166
}
167167

168+
@Override
169+
public int getNumberCatTraps(){
170+
return this.gameWorld.getTrapCount(TrapType.CAT_TRAP, this.getTeam());
171+
}
172+
173+
@Override
174+
public int getNumberRatTraps(){
175+
return this.gameWorld.getTrapCount(TrapType.RAT_TRAP, this.getTeam());
176+
}
177+
168178
@Override
169179
public UnitType getType() {
170180
return this.robot.getType();

0 commit comments

Comments
 (0)