From 03e8308f71b8c0b206780df5320bd85595b7dc32 Mon Sep 17 00:00:00 2001 From: androidmage Date: Tue, 12 Jan 2016 18:50:53 -0500 Subject: [PATCH] Updated archon escape and guards Archons will always to try move anywhere but where it is if can be potentially attacked and guards no longer throw Game Action Exception. --- RobotPlayer.java | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/RobotPlayer.java b/RobotPlayer.java index 2bbc3b3..d3c2bd2 100644 --- a/RobotPlayer.java +++ b/RobotPlayer.java @@ -189,15 +189,17 @@ public void run() { Signal[] signals = rc.emptySignalQueue(); if(signals.length > 0){ //if == 0, no signals, so not ready for(Signal s: signals){ - if(moveCount < 1 && s.getTeam() == ourTeam && rc.senseRobot(s.getID()).type == RobotType.ARCHON){ + if(moveCount < 1 && s.getTeam() == ourTeam){ FancyMessage f = FancyMessage.getFromRecievedSignal(s); - MapLocation archonLocation = f.senderLocation; - Direction archonDirection = rc.getLocation().directionTo(archonLocation); - Direction oppositeDirection = archonDirection.opposite(); - if(rc.isCoreReady()){ - if(rc.canMove(oppositeDirection)){ - rc.move(oppositeDirection); - moveCount += 1; + if(f.type == 0){ + MapLocation archonCreatorLocation = f.senderLocation; + Direction archonDirection = rc.getLocation().directionTo(archonCreatorLocation); + Direction oppositeDirection = archonDirection.opposite(); + if(rc.isCoreReady()){ + if(rc.canMove(oppositeDirection)){ + rc.move(oppositeDirection); + moveCount += 1; + } } } } @@ -938,6 +940,12 @@ public static void escapeEnemy(){ return; } } + for(Direction possibleDirection: DIRECTIONS){ + if(rc.canMove(possibleDirection)){ + rc.move(possibleDirection); + return; + } + } } catch (Exception e) { System.out.println(e.getMessage()); @@ -960,6 +968,9 @@ public static ArrayList dangerousRobots(RobotInfo[] enemies, MapLocat dangerousEnemies.add(enemy); } } + if(dangerousEnemies.isEmpty()){ + return null; + } return dangerousEnemies; }