From 343e81c985e03f601085cdf615a78f56b6127358 Mon Sep 17 00:00:00 2001 From: Soupdoop Date: Thu, 7 Jan 2016 17:30:05 -0500 Subject: [PATCH] Update RobotPlayer.java --- RobotPlayer.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/RobotPlayer.java b/RobotPlayer.java index 726d15a..dd18526 100644 --- a/RobotPlayer.java +++ b/RobotPlayer.java @@ -479,6 +479,35 @@ public static void collectEnemyArchonID() { } } } + + /** + * MapLocation[] inSightButOffMap + * + * Looks at all tiles in sight range, returns all those that are off the map + * + * @return array of MapLocations in sight but not on the map + * + */ + public static MapLocation[] inSightButOffMap(){ + MapLocation[] allInSight = MapLocation.getAllMapLocationsWithinRadiusSq(rc.getLocation(),rc.getType.sensorRadiusSquared); + int numOffMap = 0; + for(int i = 0; i < allInSight.length; i++){ + if(rc.onTheMap(allInSight[i])){ + allInSight[i] = null; + }else{ + numOffMap++; + } + } + MapLocation[] ret = new MapLocation[numOffMap]; + int count = 0; + for(int i = 0; i < allInSight.length && count < ret.length; i++){ + if(allInSight[i] != null){ + ret[count] = allInSight[i]; + count++; + } + } + return ret; + } } /**