From 52a5aeb93cf408b20ed53346323f91e1862787c9 Mon Sep 17 00:00:00 2001 From: androidmage Date: Tue, 12 Jan 2016 23:11:36 -0500 Subject: [PATCH] Added viper class but not implemented --- RobotPlayer.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/RobotPlayer.java b/RobotPlayer.java index 5f42261..1f0f175 100644 --- a/RobotPlayer.java +++ b/RobotPlayer.java @@ -59,8 +59,60 @@ else if(selftype == RobotType.SOLDIER) { Soldier s = new RobotPlayer().new Soldier(); s.run(); } + else if(selftype == RobotType.VIPER){ + Viper s = new RobotPlayer().new Viper(); + s.run(); + } } + /** + * + * Class Viper + * + * The class outlining our viper bots + * + */ + private class Viper{ + public MapLocation enemyArchonLocation; + public boolean goOffense; + + public Viper() { + goOffense = false; + } + + public void run() { + while(true) { + try { + // Use Guard AI (move out) until there are enough soldiers ammassed around, then go towards enemy archon and attack + Signal[] signals = rc.emptySignalQueue(); + if (signals.length > 0) { + for (Signal s : signals) { + // receive a message containing enemy archon ID + if (s.getTeam() == ourTeam) { + FancyMessage f = FancyMessage.getFromRecievedSignal(s); + if(f.type == 2){ + int xPos = f.ints.first; + int yPos = f.ints.second; + enemyArchonLocation = new MapLocation(xPos, yPos); + goOffense = true; + } + } + } + } + if(rc.isCoreReady() && goOffense){ + RESOURCE_FUNCTIONS.BUG(enemyArchonLocation); + } + if(rc.isWeaponReady()){ + RESOURCE_FUNCTIONS.attackWeakestEnemy(); + } + Clock.yield(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } /** * * Class Turret