Skip to content

Commit 981e5a2

Browse files
examplefuncsplayer improvement
1 parent f293c46 commit 981e5a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ public static void runSoldier(RobotController rc) throws GameActionException{
181181
rc.move(dir);
182182
}
183183
// Try to paint beneath us as we walk to avoid paint penalties.
184-
if (rc.canAttack(rc.getLocation())){
184+
// Avoiding wasting paint by re-painting our own tiles.
185+
MapInfo currentTile = rc.senseMapInfo(rc.getLocation());
186+
if (!currentTile.getPaint().isAlly() && rc.canAttack(rc.getLocation())){
185187
rc.attack(rc.getLocation());
186188
}
187189
}

0 commit comments

Comments
 (0)