public void GatherInformation() { if (Analyzer == null) { Analyzer = new BonusAnalyzer(this); } else { Analyzer.Process(); } OpponentVision.Clear(); var fullMap = BotMap; foreach (var r_1 in fullMap.VisibleTerritories.Where(o => IsOpponent(o.OwnerPlayerID))) { foreach (var neighbor in r_1.Neighbors) { if (neighbor.IsVisible && neighbor.OwnerPlayerID == Me.ID) { OpponentVision[neighbor.ID] = neighbor.Armies; } } } CaptureCosts = ConstructCaptureCosts(this); Eval = new EdgePriorityComparator(this, CaptureCosts, Analyzer); }
public TerritoryBipartiteNetwork(CowzowBot bot, EdgePriorityComparator eval) : base(bot) { Start = new BotTerritory(bot, BotTerritory.DummyID); End = new BotTerritory(bot, BotTerritory.DummyID); AddVertex(Start); AddVertex(End); Attackers = new HashSet <TerritoryIDType>(); Targets = new HashSet <TerritoryIDType>(); this.Eval = eval; }
public static Edge FindBest(List <Edge> edgeList, EdgePriorityComparator eval) { var best = edgeList[0]; foreach (var e in edgeList) { if (eval.Compare(e, best) < 0) { best = e; } } edgeList.Remove(best); return(best); }