|
Britbot
|
Determined the minimal time (or distance) between a Group and an EnemyGroup before they will get into each others' attack radius.
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;
}
|
1.7.6.1