public MovSimStat[] futurePos(int steps, AdvancedRobot b, double maxVel, double maxTurnRate) { return futurePos( steps, b.getX(), b.getY(), b.getVelocity(), maxVel, b.getHeadingRadians(), b.getDistanceRemaining(), b.getTurnRemainingRadians(), maxTurnRate, b.getBattleFieldWidth(), b.getBattleFieldHeight()); }
public void update(AdvancedRobot self) { if (self.getName().equals(name)) { tc.update( self.getTime(), self.getEnergy(), tm.predict_gun_heading(self, tc), tm.predict_gun_heat(self, tc), correct_angle(self.getHeadingRadians()), self.getVelocity(), self.getX(), self.getY()); mm.update(self); } }
public RobotModel(AdvancedRobot self) { this( self.getName(), self.getHeight(), self.getWidth(), self.getEnergy(), self.getGunCoolingRate(), self.getGunHeadingRadians(), self.getGunHeat(), self.getRadarHeadingRadians(), self.getHeadingRadians(), self.getVelocity(), self.getX(), self.getY()); }
public void surf() { RobotState currentState = new RobotState( ScanLog.myLocation(), _robot.getHeadingRadians(), _robot.getVelocity(), _robot.getTime()); boolean goingClockwise = (_lastMovementChoice == CLOCKWISE_OPTION); double orbitCounterClockwiseDanger = checkDanger( currentState, COUNTERCLOCKWISE_OPTION, goingClockwise, FIRST_WAVE, WAVES_TO_SURF); double stopDanger = checkDanger(currentState, STOP_OPTION, goingClockwise, FIRST_WAVE, WAVES_TO_SURF); double orbitClockwiseDanger = checkDanger(currentState, CLOCKWISE_OPTION, goingClockwise, FIRST_WAVE, WAVES_TO_SURF); int goOrientation = _lastMovementChoice; Wave orbitWave = findSurfableWave(FIRST_WAVE); double orbitAbsBearing, distanceToClosestWaveSource; try { distanceToClosestWaveSource = ScanLog.myLocation().distance(orbitWave.sourceLocation); orbitAbsBearing = DUtils.absoluteBearing(orbitWave.sourceLocation, ScanLog.myLocation()); } catch (NullPointerException noSurfableWaves) { distanceToClosestWaveSource = ScanLog.getLastDistance(); orbitAbsBearing = ScanLog.getLastEnemyScan().getAbsBearingRadians(); } double goAngle, attackAngle; if (stopDanger == NO_SURFABLE_WAVES) { attackAngle = -1.047; _robot.setMaxVelocity(8); double goAngleCcw = orbitAbsBearing + (COUNTERCLOCKWISE_OPTION * ((Math.PI / 2) + attackAngle)); goAngleCcw = wallSmoothing( ScanLog.myLocation(), goAngleCcw, COUNTERCLOCKWISE_OPTION, distanceToClosestWaveSource); double goAngleCw = orbitAbsBearing + (CLOCKWISE_OPTION * ((Math.PI / 2) + attackAngle)); goAngleCw = wallSmoothing( ScanLog.myLocation(), goAngleCw, CLOCKWISE_OPTION, distanceToClosestWaveSource); if (Math.abs(Utils.normalRelativeAngle(goAngleCw - orbitAbsBearing)) < Math.abs(Utils.normalRelativeAngle(goAngleCcw - orbitAbsBearing))) { goOrientation = CLOCKWISE_OPTION; goAngle = goAngleCw; } else { goOrientation = COUNTERCLOCKWISE_OPTION; goAngle = goAngleCcw; } } else { _robot.setMaxVelocity(8); attackAngle = _currentDistancer.attackAngle(distanceToClosestWaveSource, _desiredDistance); if (ScanLog.enemyIsRammer() && ScanLog.getLastDistance() < 300 && orbitWave != NO_WAVE_FOUND) { if (Utils.normalRelativeAngle( DUtils.absoluteBearing(ScanLog.myLocation(), orbitWave.sourceLocation) - ScanLog.getLastScan().getAbsBearingRadians()) > 0) { goOrientation = -1; } else { goOrientation = 1; } } else if (stopDanger <= orbitCounterClockwiseDanger && stopDanger <= orbitClockwiseDanger && !ScanLog.enemyIsRammer()) { _robot.setMaxVelocity(0); } else { if (orbitClockwiseDanger < orbitCounterClockwiseDanger) { goOrientation = CLOCKWISE_OPTION; } else { goOrientation = COUNTERCLOCKWISE_OPTION; } } goAngle = orbitAbsBearing + (goOrientation * ((Math.PI / 2) + attackAngle)); goAngle = wallSmoothing(ScanLog.myLocation(), goAngle, goOrientation, distanceToClosestWaveSource); } DUtils.setBackAsFront(_robot, goAngle); _lastMovementChoice = goOrientation; }