Britbot
static bool Britbot.Extensions.IsPassableEnough ( this IPirateGame  game,
Location  loc,
Group  group 
) [inline, static]

This function checks if it is possible for a given group to be in certain location without pirates getting in enemy zone.

Parameters:
gameCompiler magic

DAMM RIGHT IT IS

Parameters:
locthe location of the 0 ring (the one we check)
groupthe group trying to pass
Returns:
true if it is possible to put this group in this location

Definition at line 77 of file Extentions.cs.

        {
            //Logger.BeginTime("IsPassableEnough");
            //going over all the pirates in the group
            foreach (int pirate in group.Pirates)
            {
                //calculate differance vector between the Group's center and the given pirate
                HeadingVector difference = HeadingVector.CalcDifference(group.FindCenter(true)
                    , Bot.Game.GetMyPirate(pirate).Loc);

                //calculate the location of this pirate if the group is placed in loc
                Location newLocation = HeadingVector.AddvanceByVector(loc, difference);

                //check if isn't passable, if so return false
                if (!game.IsInMap(newLocation) || !game.IsPassable(newLocation))
                    return false;
            }
            //Logger.StopTime("IsPassableEnough");
            //otherwise return true since all the pirates can fit here
            return true;
            /*
            //go over the locations and check if they are passable.
            for (int deltaX = -passRadius; deltaX <= passRadius; deltaX++)
            {
                for (int deltaY = -passRadius + Math.Abs(deltaX); deltaY <= passRadius - Math.Abs(deltaX); deltaY++)
                {
                    Location testLocation = new Location(loc.Row + deltaY, loc.Col + deltaX);

                    //check if passable
                    if (!game.IsInMap(testLocation) || !game.IsPassable(testLocation))
                        return false;
                }
            }
            */
            //return true if Ok
        }