Britbot
Score Britbot.EnemyGroup.GetScore ( Group  origin) [inline]

Gets the score for this group.

Parameters:
originThe group requesting the evaluation
Returns:
The score for this group

Implements Britbot.ITarget.

Definition at line 83 of file EnemyGroup.cs.

        {
            //first check if groups direction is stable, otherwise disqualify
            if (this.GetHeadingSabilityCoeff() < Magic.HeadingStabilityCoeff)
                return null;

            //check if the enemy group isn't in spawn - else disqualify
            if (!Bot.Game.IsPassable(this.GetLocation()))
                return null;

            //next check if it even possible to catch the ship, otherwise disqualify
            if (!Navigator.IsReachable(origin.GetLocation(), GetLocation(), this.GetHeading()))
                return null;

            //Reduce the score in proportion to distance. Lower score is worse. Mind the minus sign!
            double distance = Navigator.CalcDistFromLine(origin.GetLocation(), this.GetLocation(), this.GetHeading());

            //consider attack radius
            distance -= Math.Sqrt(Bot.Game.GetAttackRadius());
            distance = Math.Max(distance, 0);

            //if the origin group is strong enough to take the enemy group add its score
            if (origin.FightCount() > this.GetMaxFightPower())
                return new Score(this, TargetType.EnemyGroup, 0, this.EnemyPirates.Count, distance,
                    Bot.Game.GetSpawnTurns(), 0);

            //if this enemygroup will defeat the origin group, disqualify
            return null;
        }