Ejemplo n.º 1
0
        public List <GameOrder> GetOrders()
        {
            Debug.Debug.PrintDebugOutputBeginTurn(this);

            if (NumberOfTurns > 0)
            {
                LastVisibleMapUpdater.StoreOpponentDeployment();
            }
            StatelessFogRemover.RemoveFog();
            //FogRemover.RemoveFog();
            this.HistoryTracker.ReadOpponentDeployment();
            this.WorkingMap = this.VisibleMap.GetMapCopy();
            DistanceCalculator.CalculateDistanceToBorder(this, this.VisibleMap, this.WorkingMap);
            DistanceCalculator.CalculateDirectDistanceToOpponentTerritories(this.VisibleMap, this.VisibleMap);
            DistanceCalculator.CalculateDistanceToOpponentBonuses(this.VisibleMap);
            DistanceCalculator.CalculateDistanceToOwnBonuses(this.VisibleMap);
            this.BonusExpansionValueCalculator.ClassifyBonuses(this.VisibleMap, this.VisibleMap);
            this.TerritoryValueCalculator.CalculateTerritoryValues(this.VisibleMap, this.WorkingMap);

            foreach (var opp in this.Opponents)
            {
                this.OpponentDeploymentGuesser.GuessOpponentDeployment(opp.ID);
            }
            this.MovesCalculator.CalculateMoves();
            Debug.Debug.PrintDebugOutput(this);

            Debug.Debug.PrintGuessedDeployment(VisibleMap, this);
            Debug.Debug.printExpandBonusValues(VisibleMap, this);
            Debug.Debug.PrintTerritoryValues(VisibleMap, this);
            Debug.Debug.PrintTerritories(VisibleMap, this);
            //LastVisibleMap = VisibleMap.GetMapCopy();
            return(this.MovesCalculator.CalculatedMoves.Convert());
        }
Ejemplo n.º 2
0
        public BotTerritory(BotMap parent, TerritoryIDType id, PlayerIDType playerID, Armies armies)
        {
            this.Parent = parent;
            this.ID     = id;

            this.OwnerPlayerID = playerID;
            this.Armies        = armies;
        }
Ejemplo n.º 3
0
        public int GetGuessedOpponentIncome(PlayerIDType opponentID, BotMap mapToUse)
        {
            var outvar = Settings.MinimumArmyBonus;

            foreach (var bonus in mapToUse.Bonuses.Values)
            {
                if (bonus.IsOwnedByOpponent(opponentID))
                {
                    outvar += bonus.Amount;
                }
            }

            return(outvar);
        }
Ejemplo n.º 4
0
        public List <GameOrder> GetOrders()
        {
            Debug.Debug.PrintDebugOutputBeginTurn(this);
            Memory.DeploymentTracker.AddTurn(NumberOfTurns - 1);
            if (NumberOfTurns > 0)
            {
                LastVisibleMapUpdater.StoreOpponentDeployment();
            }
            else if (NumberOfTurns == 0)
            {
                Memory.PickTracker.SetConfirmedPicks(this);
                foreach (TerritoryIDType chosenTerr in Memory.PickTracker.GetChosenPickList())
                {
                    foreach (TerritoryIDType enemyTerr in Memory.PickTracker.GetEnemyPickList())
                    {
                        PathNode final = BasicAlgorithms.Dijkstra.ShortestPath(Memory.PickTracker.pickMap, this.VisibleMap.Territories[chosenTerr], this.VisibleMap.Territories[enemyTerr]);
                        Debug.Debug.PrintPath(this.VisibleMap, final);
                    }
                }
            }
            StatelessFogRemover.RemoveFog();
            //FogRemover.RemoveFog();
            this.HistoryTracker.ReadOpponentDeployment();
            this.WorkingMap = this.VisibleMap.GetMapCopy();
            DistanceCalculator.CalculateDistanceToBorder(this, this.VisibleMap, this.WorkingMap);
            DistanceCalculator.CalculateDirectDistanceToOpponentTerritories(this.VisibleMap, this.VisibleMap);
            DistanceCalculator.CalculateDistanceToOpponentBonuses(this.VisibleMap);
            DistanceCalculator.CalculateDistanceToOwnBonuses(this.VisibleMap);
            this.BonusExpansionValueCalculator.ClassifyBonuses(this.VisibleMap, this.VisibleMap);
            this.TerritoryValueCalculator.CalculateTerritoryValues(this.VisibleMap, this.WorkingMap);

            foreach (var opp in this.Opponents)
            {
                this.OpponentDeploymentGuesser.GuessOpponentDeployment(opp.ID);
            }
            this.MovesCalculator.CalculateMoves();
            Debug.Debug.PrintDebugOutput(this);

            Debug.Debug.PrintGuessedDeployment(VisibleMap, this);
            Debug.Debug.printExpandBonusValues(VisibleMap, this);
            Debug.Debug.PrintTerritoryValues(VisibleMap, this);
            Debug.Debug.PrintTerritories(VisibleMap, this);
            //LastVisibleMap = VisibleMap.GetMapCopy();
            Debug.Debug.PrintFinalOrders(MovesCalculator.CalculatedMoves);
            return(this.MovesCalculator.CalculatedMoves.Convert());
        }
Ejemplo n.º 5
0
        public void Init(GameIDType gameID, PlayerIDType myPlayerID, Dictionary <PlayerIDType, GamePlayer> players, MapDetails map, GameStanding distributionStanding, GameSettings settings, int numTurns, Dictionary <PlayerIDType, PlayerIncome> playerIncomes, GameOrder[] prevTurn, GameStanding latestTurnStanding, GameStanding previousTurnStanding, Dictionary <PlayerIDType, TeammateOrders> teammatesOrders, List <CardInstance> cards, int cardsMustPlay, Stopwatch timer, List <string> directives)
        {
            this.Players  = players;
            this.Me       = players[myPlayerID];
            this.Settings = settings;

            this.Map        = map;
            this.VisibleMap = new BotMap(this);
            foreach (var bonus in this.Map.Bonuses.Values)
            {
                VisibleMap.Bonuses.Add(bonus.ID, new BotBonus(VisibleMap, bonus.ID));
            }

            foreach (var terr in this.Map.Territories.Values)
            {
                VisibleMap.Territories.Add(terr.ID, new BotTerritory(VisibleMap, terr.ID, TerritoryStanding.FogPlayerID, new Armies(0)));
            }

            VisibleMap = BotMap.FromStanding(this, latestTurnStanding);
            if (numTurns > 0)
            {
                LastVisibleMapX = BotMap.FromStanding(this, previousTurnStanding);
            }

            this.DistributionStanding = distributionStanding;

            this.NumberOfTurns = numTurns;
            this.PlayerIncomes = playerIncomes;

            this.PrevTurn        = prevTurn;
            this.TeammatesOrders = teammatesOrders ?? new Dictionary <PlayerIDType, TeammateOrders>();

            var allTeammatesOrders = TeammatesOrders.Values.Where(o => o.Orders != null).SelectMany(o => o.Orders).ToList();

            this.CardsPlayedByTeammates = allTeammatesOrders.OfType <GameOrderPlayCard>().Select(o => o.CardInstanceID).Concat(allTeammatesOrders.OfType <GameOrderDiscard>().Select(o => o.CardInstanceID)).ToHashSet(true);

            this.Cards         = cards;
            this.CardsMustPlay = cardsMustPlay;
            this.CardsHandler.initCards();
        }
Ejemplo n.º 6
0
        /// <returns>: a new Map object exactly the same as this one</returns>
        public BotMap GetMapCopy()
        {
            var newMap = new BotMap(this.BotState);

            foreach (var bonus in Bonuses.Values)
            {
                var newBonus = new BotBonus(newMap, bonus.ID);
                newBonus.ExpansionValueCategory = bonus.ExpansionValueCategory;
                newMap.Bonuses.Add(newBonus.ID, newBonus);
            }
            foreach (var territory in Territories.Values)
            {
                var newTerritory = new BotTerritory(newMap, territory.ID, territory.OwnerPlayerID, territory.Armies);
                newTerritory.IsOwnershipHeuristic    = territory.IsOwnershipHeuristic;
                newTerritory.ExpansionTerritoryValue = territory.ExpansionTerritoryValue;
                newTerritory.AttackTerritoryValue    = territory.AttackTerritoryValue;
                newTerritory.DefenceTerritoryValue   = territory.DefenceTerritoryValue;
                newTerritory.Armies = territory.Armies;
                newMap.Territories.Add(newTerritory.ID, newTerritory);
            }
            return(newMap);
        }
Ejemplo n.º 7
0
 public BotBonus(BotMap parent, BonusIDType id)
 {
     this.Parent = parent;
     this.ID     = id;
 }