Commit e230ebd 1 parent f0336cd commit e230ebd Copy full SHA for e230ebd
File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -233,19 +233,21 @@ public static boolean buildRuins(RobotController rc) throws GameActionException
233
233
MapInfo [] nearbyTiles = rc .senseNearbyMapInfos ();
234
234
// Search for a nearby ruin to complete.
235
235
MapInfo curRuin = null ;
236
+ int curDist = 100000000 ;
236
237
for (MapInfo tile : nearbyTiles ) {
237
- if (tile .hasRuin ()) {
238
- curRuin = tile ;
238
+ // Make sure the ruin is not already complete (has no tower on it)
239
+ if (tile .hasRuin () && rc .senseRobotAtLocation (tile .getMapLocation ()) == null ) {
240
+ int checkDist = tile .getMapLocation ().distanceSquaredTo (rc .getLocation ());
241
+ if (checkDist < curDist ) {
242
+ curDist = checkDist ;
243
+ curRuin = tile ;
244
+ }
239
245
}
240
246
}
241
247
242
248
if (curRuin != null ) {
243
249
MapLocation targetLoc = curRuin .getMapLocation ();
244
250
Direction dir = rc .getLocation ().directionTo (targetLoc );
245
- boolean isActuallyTower = rc .canTransferPaint (targetLoc , -1 );
246
- if (isActuallyTower ) {
247
- return false ;
248
- }
249
251
if (rc .canMove (dir ))
250
252
rc .move (dir );
251
253
// Mark the pattern we need to draw to build a tower here if we haven't already.
You can’t perform that action at this time.
0 commit comments