diff --git a/Example.java b/Example.java index 0cd6e76..4ffb5f0 100644 --- a/Example.java +++ b/Example.java @@ -1,6 +1,7 @@ package exampleBot; import battlecode.common.Direction; +import battlecode.common.MapLocation; import battlecode.common.RobotController; @@ -17,6 +18,12 @@ public static void run(RobotController rc) { if ( rc.isActive() ) { Direction dir = rc.getLocation().directionTo(rc.senseEnemyHQLocation()); // Get the direction to the enemy Base + MapLocation spawnLocation = rc.getLocation().add(dir); // Get me the next adjacent location in that direction + + while ( rc.senseMine(spawnLocation) != null) { // Check to see if there's a mine at that location + dir = dir.rotateLeft(); // If so, rotate until we find a direction with no mines + spawnLocation = rc.getLocation().add(dir); + } rc.spawn(dir); // Spawn a robot in that direction!! }