示例#1
0
        // TODO hier
        public List <GameOrder> GetOrders()
        {
            Debug.Debug.PrintDebugOutputBeginTurn(this);
            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.printExpandBonusValues(VisibleMap, this);
            Debug.Debug.PrintTerritoryValues(VisibleMap, this);
            //this.MovesCalculator.CalculatedMoves.DumpToLog();
            LastVisibleMap = VisibleMap.GetMapCopy();
            return(this.MovesCalculator.CalculatedMoves.Convert());
        }
示例#2
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());
        }
示例#3
0
        public void CalculateMoves()
        {
            CalculatedMoves = new Moves();
            var movesSoFar = new Moves();

            PlayCardsTask.PlayCards(BotState, movesSoFar);

            AILog.Log("Starting armies: " + BotState.MyIncome.Total);
            CalculateXBonusMoves(movesSoFar, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Normal);
            AILog.Log("Armies used after calculateXBonusMoves type 1: " + movesSoFar.GetTotalDeployment());
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            CalculateXBonusMoves(movesSoFar, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Conservative);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            CalculateXBonusMoves(movesSoFar, BotTerritory.DeploymentType.Conservative, BotTerritory.DeploymentType.Conservative);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateXBonusMoves type 2: " + movesSoFar.GetTotalDeployment());
            CalculateSnipeBonusMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateSnipeBonusMoves: " + movesSoFar.GetTotalDeployment());
            CalculateXBonusMoves(movesSoFar, 0, BotTerritory.DeploymentType.Normal);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);

            BotState.ExpansionTask.CalculateExpansionMoves(movesSoFar);


            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateExpansionMoves: " + movesSoFar.GetTotalDeployment());
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateNoPlanBreakDefendMoves(movesSoFar, false, false, true, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Normal);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateNoPlanBreakDefendMoves1: " + movesSoFar.GetTotalDeployment());
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateNoPlanBreakDefendMoves(movesSoFar, false, true, false, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Normal);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateNoPlanBreakDefendMoves: " + movesSoFar.GetTotalDeployment());
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateNoPlanBreakDefendMoves(movesSoFar, false, false, true, BotTerritory.DeploymentType.Conservative, BotTerritory.DeploymentType.Conservative);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateNoPlanBreakDefendMoves(movesSoFar, false, true, true, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Conservative);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateFlankBonusMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateFlankBonusMoves: " + movesSoFar.GetTotalDeployment());
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateNoPlanBreakDefendMoves(movesSoFar, true, false, false, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Normal);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.WorkingMap);
            CalculateNoPlanBreakDefendMoves(movesSoFar, true, false, false, BotTerritory.DeploymentType.Normal, BotTerritory.DeploymentType.Conservative);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.VisibleMap);
            CalculateNoPlanAttackTerritoriesMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            AILog.Log("Armies used after calculateNoPlanAttackTerritoriesMoves2: " + movesSoFar.GetTotalDeployment());
            BotState.TerritoryValueCalculator.CalculateTerritoryValues(BotState.VisibleMap, BotState.VisibleMap);
            CalculateMoveIdleArmiesMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            CalculateJoinInAttacksMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            var supportTransferMoves = TransferMovesChooser.CalculateJoinStackMoves(BotState);

            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            MovesCommitter.CommittMoves(BotState, supportTransferMoves);
            movesSoFar.MergeMoves(supportTransferMoves);

            CalculateNoPlanCleanupMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            CalculateMoveIdleArmiesMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            CalculateJoinInAttacksMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);
            CalculateNoPlanTryoutAttackMoves(movesSoFar);
            BotState.DeleteBadMovesTask.CalculateDeleteBadMovesTask(movesSoFar);

            AILog.Log("Armies used after all moves done: " + movesSoFar.GetTotalDeployment());
            BotState.MapUpdater.UpdateMap(BotState.WorkingMap);
            DistanceCalculator.CalculateDistanceToBorder(BotState, BotState.VisibleMap, BotState.WorkingMap);
            BotState.ExpansionMapUpdater.UpdateExpansionMap();
            DistanceCalculator.CalculateDistanceToUnimportantTerritories(BotState.ExpansionMap, BotState.VisibleMap);
            DistanceCalculator.CalculateDistanceToImportantExpansionTerritories(BotState.ExpansionMap, BotState.VisibleMap);
            DistanceCalculator.CalculateDistanceToOpponentBorderCare3(BotState.ExpansionMap, BotState.VisibleMap);
            foreach (BotBonus emBonus in BotState.ExpansionMap.Bonuses.Values)
            {
                emBonus.ExpansionValue = BotState.VisibleMap.Bonuses[emBonus.ID].ExpansionValue;
            }
            DistanceCalculator.CalculateDistanceToHighlyImportantExpansionTerritories(BotState.ExpansionMap, BotState.VisibleMap);
            DistanceCalculator.CalculateDistanceToOpponentBorderCare4(BotState.ExpansionMap, BotState.VisibleMap);
            var transferMoves = TransferMovesChooser.CalculateTransferMoves2(BotState);

            MovesCommitter.CommittMoves(BotState, transferMoves);
            movesSoFar.MergeMoves(transferMoves);
            CalculateDelayMoves(movesSoFar);
            MovesCleaner.CleanupMoves(BotState, movesSoFar);
            movesSoFar      = BotState.MovesScheduler2.ScheduleMoves(movesSoFar);
            CalculatedMoves = movesSoFar;
        }