Britbot
int Britbot.EnemyGroup.InRangeGroupDistance ( EnemyGroup  eg,
Group  group 
) [inline, private]

Determined the minimal time (or distance) between a Group and an EnemyGroup before they will get into each others' attack radius.

Parameters:
egThe EnemyGroup
groupThe Group
Returns:
The minimal time before they'd get into each others' range

Definition at line 339 of file EnemyGroup.cs.

        {
            Pirate enemyPirate = null, myPirate = null;

            int minDistance = Bot.Game.GetCols() + Bot.Game.GetRows();

            //find the two pirate from the two group with the minimum distance between
            for (int i = 0; i < eg.EnemyPirates.Count; i++)
            {
                Pirate p = Bot.Game.GetEnemyPirate(i);

                for (int j = 0; j < group.Pirates.Count; j++)
                {
                    Pirate aPirate = Bot.Game.GetMyPirate(group.Pirates[j]);

                    int distance = Bot.Game.Distance(p, aPirate);

                    if (distance >= minDistance)
                        continue;

                    minDistance = distance;
                    enemyPirate = p;
                    myPirate = aPirate;
                }
            }

            //return the distance between these pirates with the range in mind
            return Bot.Game.Distance(enemyPirate.Loc, myPirate.Loc) - Bot.Game.GetAttackRadius() * 2;
        }