Example #1
0
File: Pros.cs Project: resc/Risk
        public void Attack(TurnManager turnManager)
        {
            //var country = GetRandomOwnedCountryThatCanAttack();
            //var countryToAttack = GetRandomAdjacentCountryToAttack(country);

            var repeat = 0;
            var timeout = 0;

            do
            {
                var tempList = turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this);
                foreach (var country in tempList)
                {
                    var adjacentCountryList = country.AdjacentCountries.Where(p => p.Owner != this);

                    foreach (var countryToAttack in adjacentCountryList)
                    {
                        if (countryToAttack.NumberOfTroops < country.NumberOfTroops && country.NumberOfTroops > 3)
                        {
                            turnManager.Attack(country, countryToAttack,
                                                                      country.NumberOfTroops - 1);
                            repeat++;
                        }
                    }
                }

                timeout++;
            } while (repeat < 2 && timeout < 200);
        }
Example #2
0
File: Player2.cs Project: resc/Risk
 private Country GetRandomOwnedCountryThatCanAttack(TurnManager turnManager)
 {
     var ownedCountries =turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this).Where(c => c.NumberOfTroops > 1 &&
                                                                                        c.AdjacentCountries.Any(
                                                                                            ac =>
                                                                                            ac.Owner != c.Owner))
                                         .ToList();
     return ownedCountries[r.Next(0, ownedCountries.Count - 1)];
 }
Example #3
0
        public void Deploy(TurnManager turnManager, int numberOfTroops)
        {
            gameInformation = turnManager.GetGameInfo();

            //exclude all isolated countries (all countries with only enemy neighbours)
            var countriesToAimAt =
                gameInformation.GetAllCountriesOwnedByPlayer(this)
                               .Where(x => gameInformation.GetAdjacentCountriesWithSameOwner(x).Any())
                               .ToArray();

            //Determine defensiveRate.
            //While there are countries with low defensiveRate (number of own troops / number of surrounding troups), make those stronger.
            var countriesWithEnemyNeighbours =
                countriesToAimAt.Where(x => gameInformation.GetAdjacentCountriesWithDifferentOwner(x).Count > 0)
                                .ToArray();
            var defensiveRates =
                GetDefensiveRates(countriesWithEnemyNeighbours).OrderBy(x => x.Value);

            while (defensiveRates.First().Value < DEFENSIVE_THRESHOLD_FOR_DEPLOYMENT && numberOfTroops > 0)
            {
                turnManager.DeployTroops(defensiveRates.First().Key, 1);
                defensiveRates = GetDefensiveRates(countriesWithEnemyNeighbours).OrderByDescending(x => x.Value);
                numberOfTroops--;
            }

            //Get the continent with the biggest presence.
            //Determine what country has the highest defensiveRate (number of own troops / number of surrounding troups), make those even stronger.
            //Make sure this ratio is not too big.
            var biggestContinent = GetBiggestOwnedContinentWithRemainingEnemyCountries();

            var allOwnCountriesInBiggestContinent =
                countriesToAimAt.Where(x => x.Continent == biggestContinent.Key).ToArray();
            var countriesWithRates =
                GetDefensiveRates(allOwnCountriesInBiggestContinent)
                    .Where(x => x.Key.NumberOfTroops < MAX_TROOPS_FOR_DEPLOYMENT)
                    .OrderByDescending(x => x.Value);

            while (countriesWithRates.Any() && numberOfTroops > 0)
            {
                turnManager.DeployTroops(countriesWithRates.First().Key, 1);
                countriesWithRates =
                    GetDefensiveRates(allOwnCountriesInBiggestContinent)
                        .Where(x => x.Key.NumberOfTroops < MAX_TROOPS_FOR_DEPLOYMENT)
                        .OrderByDescending(x => x.Value);
                numberOfTroops--;
            }

            while (numberOfTroops > 0)
            {
                turnManager.DeployTroops(GetRandomOwnedCountry(turnManager), 1);
                numberOfTroops--;
            }
        }
Example #4
0
        public void Attack(TurnManager turnManager)
        {
            gameInformation = turnManager.GetGameInfo();

            var countryToAttackWith = GetCountryToAttackWith();
            while (countryToAttackWith != null)
            {
                turnManager.Attack(countryToAttackWith.Item1, countryToAttackWith.Item2,
                                                          countryToAttackWith.Item1.NumberOfTroops - 1);
                countryToAttackWith = GetCountryToAttackWith();
            }
        }
Example #5
0
File: Aad.cs Project: resc/Risk
        public void Move(TurnManager turnManager)
        {
            for (var i = 0; i < 250; i++)
            {
                var info = turnManager.GetGameInfo();
                foreach (var country in info.GetAllCountriesOwnedByPlayer(this))
                {
                    var surroundingFriendlyCountries =
                        country.AdjacentCountries.ToList().Where(c => c.Owner == this).Count();

                    if (surroundingFriendlyCountries == country.AdjacentCountries.Count)
                    {
                        while (country.NumberOfTroops > 1)
                        {
                            MoveTroopsToSurroundingCountries(turnManager, country);
                        }
                    }
                }
            }
        }
Example #6
0
File: Aad.cs Project: resc/Risk
        private bool IsLastEnemyInContinent(TurnManager turnManager, Country country)
        {
            var victimContinent = country.Continent;

            var info = turnManager.GetGameInfo();

            var myCountriesInContinent =
                info.GetAllCountriesOwnedByPlayer(this).Count(c => c.Continent == country.Continent);
            var allCountriesInContinent = info.GetAllCountries().Count(c => c.Continent == country.Continent);

            return (allCountriesInContinent - myCountriesInContinent) == 1;
        }
Example #7
0
File: Pros.cs Project: resc/Risk
        public void Move(TurnManager turnManager)
        {
            var movesLeft = 7;

            var tempList = turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this);

            foreach (var country in tempList)
            {
                if (country.NumberOfTroops > 1)
                {
                    var hasHostile = false;
                    var checkForHostileCountries =
                        country.AdjacentCountries.Where(p => p.Owner != this).ToList();

                    if (checkForHostileCountries.Count > 0)
                    {
                        hasHostile = true;
                    }

                    if (hasHostile == false)
                    {
                        var adjacentCountryListOwned =
                            country.AdjacentCountries.Where(p => p.Owner == this).ToList();

                        foreach (var countryToMove in adjacentCountryListOwned)
                        {
                            var adjacentCountryListEnemey =
                                countryToMove.AdjacentCountries.Where(p => p.Owner != this).ToList();
                            var hasHostile2 = false;
                            if (adjacentCountryListEnemey.Count > 0)
                            {
                                hasHostile2 = true;
                            }

                            if (hasHostile2)
                            {
                                if (country.NumberOfTroops - 1 > 0 && movesLeft > 0)
                                {
                                    if (movesLeft > (country.NumberOfTroops - 1))
                                    {
                                        turnManager.MoveTroops(country, countryToMove,
                                                                                      country.NumberOfTroops - 1);
                                        movesLeft = movesLeft - (country.NumberOfTroops - 1);
                                    }
                                    else
                                    {
                                        turnManager.MoveTroops(country, countryToMove, movesLeft);
                                        movesLeft = 0;
                                    }
                                }
                            }
                            else
                            {
                                var adjacentCountryListOwned2 =
                                    countryToMove.AdjacentCountries.Where(p => p.Owner == this).ToList();

                                foreach (var countryToMove2 in adjacentCountryListOwned2)
                                {
                                    var adjacentCountryListEnemey2 =
                                        countryToMove2.AdjacentCountries.Where(p => p.Owner != this).ToList();
                                    var hasHostile3 = false;
                                    if (adjacentCountryListEnemey2.Count > 0)
                                    {
                                        hasHostile3 = true;
                                    }

                                    if (hasHostile3)
                                    {
                                        if (country.NumberOfTroops - 1 > 0 && movesLeft > 0)
                                        {
                                            if (movesLeft > (country.NumberOfTroops - 1))
                                            {
                                                turnManager.MoveTroops(country, countryToMove,
                                                                                              country.NumberOfTroops - 1);
                                                movesLeft = movesLeft - (country.NumberOfTroops - 1);
                                            }
                                            else
                                            {
                                                turnManager.MoveTroops(country, countryToMove,
                                                                                              movesLeft);
                                                movesLeft = 0;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        //hmm
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #8
0
        private void DoContinentAnalysis(TurnManager turnManager, RiskAnalysis analysis)
        {
            // compute continent statistics
            var continents = from c in turnManager.GetGameInfo().GetAllCountries()
                             group c by c.Continent
                                 into continent
                                 select new Continent
                                     {
                                         Name = continent.Key,
                                         MyCountries =
                                             continent.Where(x => x.Owner == _player).ToList(),
                                         EnemyCountries =
                                             continent.Where(x => x.Owner != _player)
                                                      .OrderBy(x => x.NumberOfTroops)
                                                      .ToList(),
                                         Opponents =
                                             continent.Where(x => x.Owner != _player)
                                                      .Distinct(x => x.Owner)
                                                      .ToList()
                                     };

            analysis.Continents.AddRange(continents);
        }
Example #9
0
 private void DoDeployAnalysis(TurnManager turnManager, RiskAnalysis analysis)
 {
     var gameInfo = turnManager.GetGameInfo();
     var troops = gameInfo.GetNumberOfUnitsToDeploy(_player);
     troops = troops - AustraliaRuleZ(turnManager, analysis, troops);
     troops = troops - DeployContinentGatewayDefence(turnManager, analysis, troops);
     troops = troops - DeployOffence(turnManager, analysis, troops);
     troops = troops - RescueLastManStanding(turnManager, analysis, troops);
     DeployRemaining(turnManager, analysis, troops, gameInfo);
 }
Example #10
0
File: Pros.cs Project: resc/Risk
        /*

         DONT LOOK AT OUR CODE PLS

         */
        public void Deploy(TurnManager turnManager, int numberOfTroops)
        {
            if (numberOfTroops == 2)
            {
                var tempList = turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this);
                var Australia = tempList.Where(p => p.Continent == EContinent.Australia).ToList();
                var SouthAmerica = tempList.Where(p => p.Continent == EContinent.SouthAmerica).ToList();
                var Africa = tempList.Where(p => p.Continent == EContinent.Africa).ToList();
                var NorthAmerica = tempList.Where(p => p.Continent == EContinent.NorthAmerica).ToList();
                var Europe = tempList.Where(p => p.Continent == EContinent.Europe).ToList();
                var Asia = tempList.Where(p => p.Continent == EContinent.Asia).ToList();
                var AustraliaCount = Australia.Count;
                if (Australia.Count >= 2)
                {
                    if (AustraliaCount == 4)
                    {
                        var AustraliaBottleNeck =
                            tempList.Where(p => p.Continent == EContinent.Australia && p.Number == 4).Single();
                        var i = AustraliaBottleNeck.AdjacentCountries.Where(p => p.Owner != this).ToList();
                        while (AustraliaBottleNeck.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                        {
                            turnManager.DeployTroops(AustraliaBottleNeck, 1);
                            numberOfTroops--;
                        }
                    }
                    else
                    {
                        var Random = new Random();
                        var AustraliaBottleNeck =
                            tempList.Where(p => p.Continent == EContinent.Australia);
                        if (AustraliaBottleNeck != null)
                        {
                            var index = Random.Next(Australia.Count);
                            var country = Australia[index];
                            var i = country.AdjacentCountries.Where(p => p.Owner != this).ToList();
                            while (country.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                            {
                                turnManager.DeployTroops(country, 1);
                                numberOfTroops--;
                            }
                        }
                    }
                }
                if (SouthAmerica.Count >= 2)
                {
                    var Random = new Random();
                    var SouthAmericaBottleNeck =
                        tempList.Where(p => p.Continent == EContinent.SouthAmerica);
                    if (SouthAmericaBottleNeck != null)
                    {
                        var index = Random.Next(SouthAmerica.Count);
                        var country = SouthAmerica[index];
                        var i = country.AdjacentCountries.Where(p => p.Owner != this).ToList();
                        while (country.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                        {
                            turnManager.DeployTroops(country, 1);
                            numberOfTroops--;
                        }
                    }
                }

                if (Africa.Count >= 4)
                {
                    var Random = new Random();
                    var AfricaBottleNeck = tempList.Where(p => p.Continent == EContinent.Africa);
                    if (AfricaBottleNeck != null)
                    {
                        var index = Random.Next(Africa.Count);
                        var country = Africa[index];
                        var i = country.AdjacentCountries.Where(p => p.Owner != this).ToList();
                        while (country.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                        {
                            turnManager.DeployTroops(country, 1);
                            numberOfTroops--;
                        }
                    }
                }
                if (NorthAmerica.Count >= 5)
                {
                    var Random = new Random();
                    var AfricaBottleNeck = tempList.Where(p => p.Continent == EContinent.NorthAmerica);
                    if (AfricaBottleNeck != null)
                    {
                        var index = Random.Next(NorthAmerica.Count);
                        var country = NorthAmerica[index];
                        var i = country.AdjacentCountries.Where(p => p.Owner != this).ToList();
                        while (country.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                        {
                            turnManager.DeployTroops(country, 1);
                            numberOfTroops--;
                        }
                    }
                }
                if (Europe.Count >= 7)
                {
                    var Random = new Random();
                    var AfricaBottleNeck = tempList.Where(p => p.Continent == EContinent.Europe);
                    if (AfricaBottleNeck != null)
                    {
                        var index = Random.Next(Europe.Count);
                        var country = Europe[index];
                        var i = country.AdjacentCountries.Where(p => p.Owner != this).ToList();
                        while (country.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                        {
                            turnManager.DeployTroops(country, 1);
                            numberOfTroops--;
                        }
                    }
                }

                if (Asia.Count >= 8)
                {
                    var Random = new Random();
                    var AfricaBottleNeck = tempList.Where(p => p.Continent == EContinent.Asia);
                    if (AfricaBottleNeck != null)
                    {
                        var index = Random.Next(Asia.Count);
                        var country = Asia[index];
                        var i = country.AdjacentCountries.Where(p => p.Owner != this).ToList();
                        while (country.NumberOfTroops < 10 && numberOfTroops > 0 && i.Count > 0)
                        {
                            turnManager.DeployTroops(country, 1);
                            numberOfTroops--;
                        }
                    }
                }

                while (numberOfTroops > 0)
                {
                    var target = GetRandomOwnedCountry(turnManager);

                    var i = target.AdjacentCountries.Where(p => p.Owner != this).ToList();
                    if (i.Count > 0)
                    {
                        if (target.NumberOfTroops < 7)
                        {
                            var z = 0;
                            while (numberOfTroops > 0)
                            {
                                turnManager.DeployTroops(GetRandomOwnedCountry(turnManager), 1);
                                z++;
                                numberOfTroops--;
                                if (z > 30)
                                {
                                    break;
                                }
                            }
                        }

                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                while (numberOfTroops > 0)
                {
                    turnManager.DeployTroops(GetRandomOwnedCountry(turnManager), 1);

                    numberOfTroops--;
                }
            }
            else
            {
                var myCountries = turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this);
                var potential = new List<Country>();
                foreach (var country in myCountries)
                {
                    if (country.AdjacentCountries.Where(p => p.Owner != this).ToList().Count > 0)
                    {
                        potential.Add(country);
                    }
                }
                var tempList = potential.OrderBy(p => p.NumberOfTroops).ToList();
                foreach (var countryy in tempList)
                {
                    while (countryy.NumberOfTroops < 10 && numberOfTroops > 0)
                    {
                        turnManager.DeployTroops(countryy, 1);
                        numberOfTroops--;
                    }
                }
                if (numberOfTroops > 0)
                {
                    foreach (var countryy in tempList)
                    {
                        while (numberOfTroops > 0)
                        {
                            turnManager.DeployTroops(countryy, 1);
                            numberOfTroops--;
                        }
                    }
                }
            }
        }
Example #11
0
File: Aad.cs Project: resc/Risk
        private double AverageTroopsPerCountry(TurnManager turnManager)
        {
            var info = turnManager.GetGameInfo();
            var totalCountries = 0.0;
            var totalTroops = 0.0;
            info.GetAllCountriesOwnedByPlayer(this).ToList().ForEach(
                (Country c) =>
                {
                    totalCountries += 1;
                    totalTroops += c.NumberOfTroops;
                });

            return totalTroops / totalCountries;
        }
Example #12
0
        private void DoImportantCountryAnalysis(TurnManager turnManager, RiskAnalysis analysis)
        {
            var countries = analysis.Attacks.Select(x => x.FromCountry)
                           .Concat(analysis.Moves.Select(x => x.FromCountry))
                           .Concat(analysis.Deployments.Select(x => x.ToCountry))
                           .Concat(
                               turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(_player).Where(x => x.IsContinentGateway()));

            analysis.ImportantCountries.AddRange(countries);
        }
Example #13
0
        private void DoAttackAnalysis(TurnManager turnManager, RiskAnalysis analysis)
        {
            var continents = (from c in analysis.GetContinentsByDominance()
                              select c).ToList();

            if (continents.Count == 0) return; // shouldn't happen unless we've won, or have been defeated completely.

            var attacked = new HashSet<Country>();
            var gameInfo = turnManager.GetGameInfo();
            foreach (var continent in continents)
            {
                // create a lookup with the ranking of the enemies,
                // 0 is weakest...
                var enemies = continent.EnemyCountries.OrderBy(x => x.NumberOfTroops)
                                       .Select((country, rank) => new { country, rank })
                                       .ToDictionary(key => key.country, val => val.rank);

                // order friendlies by strongest first
                var friendlies = continent.MyCountries.OrderByDescending(x => x.NumberOfTroops).ToList();

                foreach (var friendly in friendlies)
                {
                    var neighbours = gameInfo.GetAdjacentCountriesWithDifferentOwner(friendly).OrderBy(x =>
                        {
                            // use TryGetValue, adjacent countries can be on a different continent.
                            // use a very high ranking for those, so we don't attack them, yet.
                            var rank = 0;
                            return enemies.TryGetValue(x, out rank) ? rank : 100;
                        }).ToList();

                    if (neighbours.Count == 0)
                        continue; // because we're surrounded by friendlies...

                    // only attack countries not already under attack.
                    var enemy = neighbours.FirstOrDefault(x => !attacked.Contains(x));
                    if (enemy != null)
                    {
                        attacked.Add(enemy);
                        AddAttack(turnManager, analysis, friendly, enemy);
                    }
                }
            }

            if (attacked.Count == 0)
            {
                // break out of owned continents
                var fromGateways = from c in gameInfo.GetAllCountriesOwnedByPlayer(_player)
                                   where c.IsContinentGatewayUnderAttack()
                                   select c;
                foreach (var friendly in fromGateways)
                {
                    var enemy = gameInfo.GetAdjacentCountriesWithDifferentOwner(friendly)
                                               .OrderBy(x => friendly.NumberOfTroops - x.NumberOfTroops)
                                               .FirstOrDefault();
                    if (enemy != null && attacked.Add(enemy))
                        AddAttack(turnManager, analysis, friendly, enemy);
                }
            }

            analysis.Attacks
                    .Sort((a, b) =>
                          (b.FromCountry.NumberOfTroops - b.ToCountry.NumberOfTroops) -
                          (a.FromCountry.NumberOfTroops - a.ToCountry.NumberOfTroops));
        }
Example #14
0
 private Country GetRandomAdjacentCountryToAttack(TurnManager turnManager, Country country)
 {
     var adjacentCountries =
         turnManager.GetGameInfo().GetAdjacentCountriesWithDifferentOwner(country);
     return adjacentCountries[r.Next(0, adjacentCountries.Count - 1)];
 }
Example #15
0
File: Aad.cs Project: resc/Risk
 private Country GetMostImportantCountry(TurnManager turnManager)
 {
     return turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this)
                                         .OrderBy(c => GetCountryScore(turnManager, c))
                                         .Last();
 }
Example #16
0
File: Aad.cs Project: resc/Risk
 private List<PossibleAttack> GetAllPossibleAttacks(TurnManager turnManager)
 {
     var allAttacks = new List<PossibleAttack>();
     foreach (var myCountry in turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this))
     {
         foreach (var victim in myCountry.AdjacentCountries.Where(v => v.Owner != this))
         {
             for (var i = 1; i < myCountry.NumberOfTroops - 1; i++)
             {
                 allAttacks.Add(new PossibleAttack(myCountry, victim, i));
             }
         }
     }
     return allAttacks;
 }
Example #17
0
        private void DoMoveAnalysis(TurnManager turnManager, RiskAnalysis analysis)
        {
            var gameinfo = turnManager.GetGameInfo();

            var minDefenders = 3;
            var sources = gameinfo.GetAllCountriesOwnedByPlayer(_player)
                        .Where(x => x.NumberOfTroops > minDefenders && !x.IsUnderAttack() && !x.IsContinentGateway())
                        .ToList();
            var movable = 7;
            var targets = new HashSet<Country>();
            foreach (var source in sources)
            {
                var target =
                    gameinfo.GetAdjacentCountriesWithSameOwner(source)
                            .Where(x => x.IsUnderAttack())
                            .OrderBy(x => x.GetThreatLevel())
                            .FirstOrDefault();
                var toMove = Math.Min(movable, (source.NumberOfTroops - minDefenders));
                if (toMove > 0)
                {
                    if (target == null)
                    {
                        var source1 = source;
                        target = gameinfo.GetAdjacentCountriesWithSameOwner(source)
                                         .Where(x => x.IsContinentGateway()
                                                     || source1.NumberOfTroops - x.NumberOfTroops > minDefenders)
                                         .OrderBy(x => x.NumberOfTroops)
                                         .FirstOrDefault(x => targets.Add(x));
                        if (target != null)
                        {
                            toMove = Math.Min(toMove, minDefenders);
                        }
                    }
                    if (target != null)
                    {
                        movable = Math.Max(0, movable - toMove);
                        analysis.Moves.Add(new Move(turnManager)
                        {
                            FromCountry = source,
                            ToCountry = target,
                            Troops = toMove
                        });
                    }
                }
            }
        }
Example #18
0
 private Country GetRandomOwnedCountry(TurnManager turnManager)
 {
     var ownedCountries = turnManager.GetGameInfo().GetAllCountriesOwnedByPlayer(this);
     return ownedCountries[r.Next(0, ownedCountries.Count - 1)];
 }
Example #19
0
        /// <returns>The number of deployed troops</returns>
        private int DeployContinentGatewayDefence(TurnManager turnManager, RiskAnalysis analysis, int availableTroops)
        {
            if (availableTroops == 0) return 0;
            var gameInformation = turnManager.GetGameInfo();
            var weakGateways = (from c in analysis.Continents
                                where c.IsOwned
                                from country in c.MyCountries
                                where country.IsContinentGateway()
                                // make it a reasonable large margin.
                                let troopTarget = GetTroopTarget(gameInformation, country)
                                where country.NumberOfTroops < troopTarget
                                select new
                                    {
                                        country,
                                        troopTarget,
                                        deployment = new Deployment(turnManager) { ToCountry = country },
                                    }).ToList();

            var deployments = weakGateways.Select(x => x.deployment).ToList();
            var i = 0;

            // deploy troops until there are no more available, or we've reached our target numer of troops everywhere.
            while (deployments.Sum(x => x.Troops) < availableTroops && weakGateways.Count > 0)
            {
                var wg = weakGateways[i];
                wg.deployment.Troops++;
                if (wg.country.NumberOfTroops + wg.deployment.Troops >= wg.troopTarget)
                {
                    weakGateways.RemoveAt(i);
                    if (weakGateways.Count == 0)
                        break;
                }
                i = (i + 1) % weakGateways.Count;
            }

            analysis.Deployments.AddRange(deployments.Where(x => x.Troops > 0));

            return deployments.Sum(x => x.Troops);
        }