Example #1
0
        private static int RemainingArmiesAfterFullScaleAssault(int defendingArmies, List <Region> attackingRegions, int attackingBonusArmies)
        {
            foreach (var neighbor in attackingRegions)
            {
                BattleResult result = BattleAnalysis.AnalyzeBattle(confidence, defendingArmies, neighbor.Armies + attackingBonusArmies);
                defendingArmies      = result.DefenderRemainingArmies;
                attackingBonusArmies = 0; // we only want the bonus applied once so set to zero after first pass
            }

            return(defendingArmies);
        }
Example #2
0
        public static Dictionary <int, int> RemainingArmiesAfterFullScaleAssault(int defendingArmies, List <Tuple <Region, int> > attackingRegionArmies)
        {
            var remainingArmies = new Dictionary <int, int>();

            foreach (var attackingRegion in attackingRegionArmies)
            {
                BattleResult result = BattleAnalysis.AnalyzeBattle(confidence, defendingArmies, attackingRegion.Item2);
                defendingArmies = result.DefenderRemainingArmies;
                remainingArmies.Add(attackingRegion.Item1.Id, result.AttackerRemainingArmiesLow);

                // no need for any other regions to participate if the enemy is destroyed
                if (defendingArmies == 0)
                {
                    break;
                }
            }

            remainingArmies.Add(-1, defendingArmies);
            return(remainingArmies);
        }