public static int[,] ConstructAdjacencyGraph(CowzowBot Bot, IList <BotTerritory> myAttackers, IList <BotTerritory> myTargets) { var graph = new int[myAttackers.Count, myTargets.Count]; for (var i = 0; i < myAttackers.Count; i++) { var myAttacker = myAttackers[i]; var myNeighbors = myAttacker.Neighbors; for (var j = i; j < myTargets.Count; j++) { var myTarget = myTargets[j]; if (myNeighbors.Contains(myTarget)) { if (myTarget.OwnerPlayerID == TerritoryStanding.NeutralPlayerID) { graph[i, j] = (int)(myTarget.Armies * 1.5 + 1); } else { graph[i, j] = (int)(myTarget.Armies * 1.5 + 5); } } } } return(graph); }
public BotTerritory(CowzowBot bot, TerritoryIDType id) { this.Bot = bot; this.ID = id; this.OwnerPlayerID = TerritoryStanding.FogPlayerID; this.Armies = 0; }
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 EdgePriorityComparator(CowzowBot bot, Dictionary <TerritoryIDType, int> captureCosts, BonusAnalyzer analyzer) { this.Bot = bot; Cache = new Dictionary <string, double>(); this.Analyzer = analyzer; this.CaptureCosts = captureCosts; if (analyzer == null) { throw new ArgumentNullException(); } }
public BotMap(CowzowBot bot, MapDetails map, GameStanding latest) { this.Bot = bot; Territories = new Dictionary <TerritoryIDType, BotTerritory>(); Bonuses = new Dictionary <BonusIDType, BotBonus>(); foreach (var terr in map.Territories.Values) { var t = new BotTerritory(bot, terr.ID); this.Territories.Add(terr.ID, t); var ts = latest.Territories[terr.ID]; t.OwnerPlayerID = ts.OwnerPlayerID; if (!ts.NumArmies.Fogged) { t.Armies = ts.NumArmies.NumArmies; } } foreach (var bonus in map.Bonuses.Values) { this.Bonuses.Add(bonus.ID, new BotBonus(bot, bonus.ID)); } }
public StartingTerritoryComparator(CowzowBot bot) { this.Bot = bot; TerritoryScoresCache = new Dictionary<TerritoryIDType, double>(); }
public TerritoryPriorityComparator(CowzowBot bot) { this.Bot = bot; }
public TerritoryNetwork(CowzowBot bot) { this.Bot = bot; AdjacencyList = new Dictionary <TerritoryIDType, Dictionary <string, Edge> >(); }
/// <summary> /// dummy constructor for testing purposes /// </summary> /// <param name="state"></param> public BotTerritory(CowzowBot bot) { this.Bot = bot; ID = (TerritoryIDType)DummyID; OwnerPlayerID = TerritoryStanding.FogPlayerID; }
public AttackOrderComparator(CowzowBot bot) { this.Bot = bot; Placements = new HashSet <TerritoryIDType>(bot.MyDeployments); Analyzer = bot.Analyzer; }
public BotBonus(CowzowBot bot, BonusIDType id) { this.Bot = bot; this.ID = id; this.ArmiesReward = bot.Settings.OverriddenBonuses.ContainsKey(id) ? bot.Settings.OverriddenBonuses[id] : Details.Amount; }
public AttackOrderComparator(CowzowBot bot) { this.Bot = bot; Placements = bot.MyDeployments.ToHashSet(true); Analyzer = bot.Analyzer; }