Esempio n. 1
0
        protected override float ScoreAngle(float angle, Vector2 position, Vector2 momentum)
        {
            var vectorToPoint = Robot.VectorToAbsolutePoint(TargetPoint);
            var angleToPoint  = MathF.Atan2(vectorToPoint.Y, vectorToPoint.X);
            var difference    = RoboMath.CalculateDifferenceBetweenAngles(angle, angleToPoint);

            return(-MathF.Abs(difference));
        }
Esempio n. 2
0
        protected override float ScoreAngle(float angle, Vector2 position, Vector2 momentum)
        {
            if (Active && AverageAngle != null)
            {
                return(-Math.Abs(RoboMath.CalculateDifferenceBetweenAngles(AverageAngle.Value, angle)));
            }

            return(0);
        }
Esempio n. 3
0
        protected float ScoreAngleByTargetPoint(Vector2 target, float angle, Vector2 position, Vector2 momentum)
        {
            if (Active)
            {
                var vectorToPoint = Robot.VectorToAbsolutePoint(target);
                var angleToPoint  = MathF.Atan2(vectorToPoint.Y, vectorToPoint.X);
                var difference    = RoboMath.CalculateDifferenceBetweenAngles(angle, angleToPoint);
                return(-MathF.Abs(difference));
            }

            return(0);
        }
Esempio n. 4
0
        protected override float ScoreAngle(float angle, Vector2 position, Vector2 momentum)
        {
            var difference = RoboMath.CalculateDifferenceBetweenAngles(angle, TargetAngle);

            if (MaximumAngle > 0 && difference > MaximumAngle)
            {
                return(-10000000);
            }
            else
            {
                return(-MathF.Abs(difference) * Scale);
            }
        }
Esempio n. 5
0
        protected override float ScoreAngle(float angle, Vector2 position, Vector2 momentum)
        {
            float accumulator = 0;

            if (FleetsOfConcern != null)
            {
                foreach (var fleet in FleetsOfConcern)
                {
                    var original = FiringInterceptAngles[fleet];
                    var newAngle = CalculateIntercept(fleet, position, momentum, LookAheadMS);

                    if (!float.IsNaN(original) && !float.IsNaN(newAngle))
                    {
                        accumulator += MathF.Abs(RoboMath.CalculateDifferenceBetweenAngles(newAngle, original));
                    }
                }
            }

            return(accumulator);
        }