From 3b8a5ebb322ab9c3d1ccb873b7e0283d83d9357d Mon Sep 17 00:00:00 2001 From: vilasopher Date: Tue, 12 Jan 2016 10:33:15 -0500 Subject: [PATCH] Update RobotPlayer.java --- RobotPlayer.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/RobotPlayer.java b/RobotPlayer.java index f59d410..9aeb158 100644 --- a/RobotPlayer.java +++ b/RobotPlayer.java @@ -280,12 +280,7 @@ public void run(){ Clock.yield(); Triple scoutType = getScoutInitType(); //Check if near zombie round - int roundNum = rc.getRoundNum(); - boolean isCloseToZombieRound = false; - for (int i = 0; i < zombieRounds.length && !isCloseToZombieRound; i++) { - isCloseToZombieRound = (Math.abs(roundNum - zombieRounds[i]) < 10); - } - if (mostRecentEnemyArchonLocations.size() != 0 && isCloseToZombieRound) { + if (mostRecentEnemyArchonLocations.size() != 0 && RESOURCE_FUNCTIONS.isCloseToZombieSpawnRound()) { scoutType = getScoutHerdingType(); } FancyMessage.sendMessage(0,scoutType.first | scoutType.second,scoutType.third,3); @@ -645,6 +640,21 @@ public static Tuple findLargestPileOfParts() { return locationAndSize; } + + /** + * isCloseToZombieSpawnRound + * @returns whether or not the current round is close enough to a zombie spawn round + * to make a scout be a zombie herder + */ + public static boolean isCloseToZombieSpawnRound() { + int roundNum = rc.getRoundNum(); + boolean isCloseToZombieRound = false; + for (int i = 0; i < zombieRounds.length && !isCloseToZombieRound; i++) { + int diff = zombieRounds[i] - roundNum; + isCloseToZombieRound = (diff < 50 && diff > -5); + } + return isCloseToZombieRound; + } /** * boolean moveAsFarAwayAsPossibleFrom