Package clarkson.cs551.robocode

Source Code of clarkson.cs551.robocode.MovingRobot

package clarkson.cs551.robocode;

import robocode.BattleEndedEvent;
import robocode.ScannedRobotEvent;
import robocode.StatusEvent;
import clarkson.cs551.BasicRobot;
import clarkson.cs551.robocode.moving.AStarTreeHandler;
import clarkson.cs551.robocode.moving.MovingHandler;
import clarkson.cs551.robocode.radar.LockingHandler;
import clarkson.cs551.robocode.radar.RadarHandler;

public class MovingRobot extends BasicRobot {

  private RadarHandler radarHandler;

  private MovingHandler movingHandler;

  public MovingRobot() {
    super();
    radarHandler = new LockingHandler();
    movingHandler = new AStarTreeHandler();
  }

  @Override
  public void run() {
    setAdjustGunForRobotTurn(true);
    setAdjustRadarForGunTurn(true);
    setAdjustRadarForRobotTurn(true);

    movingHandler.initialize(this);

    while (true) {
      radarHandler.action(this);
      movingHandler.action(this);
      execute();
    }
  }

  @Override
  public void onScannedRobot(ScannedRobotEvent event) {
    radarHandler.enemyScanned(this, event);
    movingHandler.enemyScanned(this, event);
  }

  @Override
  public void onBattleEnded(BattleEndedEvent event) {
    movingHandler.storeData(this);
  }

  @Override
  public void onStatus(StatusEvent e) {
    super.onStatus(e);
  }

}
TOP

Related Classes of clarkson.cs551.robocode.MovingRobot

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.