/// <summary> /// Creates a new MoveCompleteCondition with default priority. /// The default priority is 80. /// </summary> /// <param name="robot">Your robot, which must be a <see cref="AdvancedRobot"/></param> public MoveCompleteCondition(AdvancedRobot robot) { this.robot = robot; }
/// <summary> /// Creates a new MoveCompleteCondition with the specified priority. /// A condition priority is a value from 0 - 99. The higher value, the /// higher priority. The default priority is 80. /// <seealso cref="Condition.Priority"/> /// </summary> /// <param name="robot">Your robot, which must be a <see cref="AdvancedRobot"/></param> /// <param name="priority">The priority of this condition</param> public MoveCompleteCondition(AdvancedRobot robot, int priority) { this.robot = robot; this.priority = priority; }
/// <summary> /// Creates a new GunTurnCompleteCondition with default priority. /// The default priority is 80. /// </summary> /// <param name="robot">Your robot, which must be an <see cref="AdvancedRobot"/></param> public GunTurnCompleteCondition(AdvancedRobot robot) { this.robot = robot; }
public BlackBoard(AdvancedRobot _robot) { robot = _robot; }
public override BehaviourTreeStatus Tick() { AdvancedRobot tmpBot = this.bb.Robot; ScannedRobotEvent e = this.bb.CurrentEnemy.E; if (e == null) { return(BehaviourTreeStatus.Failure); } // Stay at right angles to the opponent tmpBot.SetTurnRight(e.Bearing + 90 - 30 * this.bb.MovementDirection); // If the bot has small energy drop, // assume it fired double changeInEnergy = this.bb.PreviousEnergy - e.Energy; if (changeInEnergy >= -3 && changeInEnergy <= 3) { // Dodge! this.bb.MovementDirection = -this.bb.MovementDirection; tmpBot.SetAhead((e.Distance / 4 + 25) * this.bb.MovementDirection); } // When a bot is spotted, // sweep the gun and radar this.bb.GunDirection = -this.bb.GunDirection; //tmpBot.TurnGunRight(360 * this.bb.GunDirection); // Track the energy level this.bb.PreviousEnergy = e.Energy; double xforce = 0; double yforce = 0; double force; double ang; /**The following four lines add wall avoidance. They will only * affect us if the bot is close to the walls due to the * force from the walls decreasing at a power 3.**/ xforce += 5000 / Math.Pow(getRange(tmpBot.X, tmpBot.Y, tmpBot.BattleFieldWidth, tmpBot.Y), 3); xforce -= 5000 / Math.Pow(getRange(tmpBot.X, tmpBot.Y, 0, tmpBot.X), 3); yforce += 5000 / Math.Pow(getRange(tmpBot.X, tmpBot.Y, tmpBot.X, tmpBot.BattleFieldHeight), 3); yforce -= 5000 / Math.Pow(getRange(tmpBot.X, tmpBot.Y, tmpBot.X, 0), 3); double angle = Utils.ToDegrees(absbearing(tmpBot.X, tmpBot.Y, tmpBot.X - xforce, tmpBot.Y - yforce)); double r = turnTo(angle); //distance = RandomNumber(80, 300); tmpBot.SetAhead(distance * r); //this.bb.Robot.Ahead(distance * angle); return(BehaviourTreeStatus.Success); }
/// <summary> /// Creates a new RadarTurnCompleteCondition with default priority. /// The default priority is 80. /// </summary> /// <param name="robot">Your robot, which must be a <see cref="AdvancedRobot"/></param> public RadarTurnCompleteCondition(AdvancedRobot robot) { this.robot = robot; }
public AbstractRobot(AdvancedRobot robot) { _dodgeGenerator = new Random(); MovingDirection = 1d; _robot = robot; }
protected Steering(AdvancedRobot robot, ScannedRobotEvent evnt) { Robot = robot; Event = evnt; }
public Algorithm(AdvancedRobot robot) { _self = robot; }
public CalculatedParams(AdvancedRobot robot, ScannedRobotEvent e) { AbsoluteBearing = e.BearingRadians + robot.HeadingRadians; LaterVelocity = e.Velocity * Math.Sin(e.HeadingRadians - AbsoluteBearing); }
public virtual void Init(AdvancedRobot ourRobot) { Robot = ourRobot; }
public static double TurnRobotToPoint(AdvancedRobot myRobot, PointF dest) { var absDeg = AbsoluteBearingDegrees(myRobot.X, myRobot.Y, dest.X, dest.Y); return(TurnRightOptimalAngle(myRobot.Heading, absDeg)); }
/// <summary> /// Gets the bearing in degrees /// </summary> /// <param name="point"></param> /// <param name="robot"></param> /// <returns>Bearing in degrees to target</returns> public static double GetBearing(PointF point, AdvancedRobot robot) { var bearing = Math.PI / 2 - Math.Atan2(point.Y - robot.Y, point.X - robot.X); return(NormalizeBearing((180 / Math.PI) * (bearing - robot.HeadingRadians))); }