private void scanForParts() { AppendOnlyMapLocationArray parts = PartsUtilities.findPartsAndNeutralsICanSense(rc); if (currentLocation.equals(castleMove.getTarget())) { castleMove.setTarget(null); } if (parts.length > 0 && castleMove.getTarget() == null) { castleMove.setTarget(parts.array[0]); } }
private boolean moveToParts() throws GameActionException { if (castleMove.getTarget() == null || round - lastMove < 3) { return false; } Direction toMove = castleMove.getNextDirToTarget(); if (castleMove.canMove(toMove)) { move(toMove); return true; } return false; }
private boolean randomMove() throws GameActionException { // prereqs if (soldiersFiring || soldiersDamaged || round - lastMove < 3) { return false; } Direction rand = MapUtils.randomDirection(id, round); if (rc.canMove(rand) && castleMove.canMove(rand)) { move(rand); return true; } return false; }
private boolean moveAwayFromBigZombies() throws GameActionException { // prereq if (nearByZombies.length == 0 || round - lastMove < 3) { return false; } AppendOnlyMapLocationArray bigZombieLoc = new AppendOnlyMapLocationArray(); for (int i = nearByZombies.length; --i >= 0; ) { if (nearByZombies[i].type.equals(RobotType.BIGZOMBIE)) { bigZombieLoc.add(nearByZombies[i].location); } } if (bigZombieLoc.length == 0) { return false; } Direction toMove = bigZombieLoc.array[0].directionTo(currentLocation); if (castleMove.canDangerousMove(toMove)) { move(toMove); return true; } return false; }