Exemple #1
0
        public void Attack(TurnManager turnManager)
        {
            var country = GetRandomOwnedCountryThatCanAttack(turnManager);
            var countryToAttack = GetRandomAdjacentCountryToAttack(turnManager, country);

            turnManager.Attack(country, countryToAttack, country.NumberOfTroops - 1);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
Fichier : Aad.cs Projet : resc/Risk
        public void Attack(TurnManager turnManager)
        {
            for (var i = 1; i < 250; i++)
            {
                var possibleAttacks = GetAllPossibleAttacks(turnManager);

                foreach (var possibleAttack in possibleAttacks)
                {
                    possibleAttack.SuccesRate = GetSuccessRate(possibleAttack);
                }

                var myAttack = possibleAttacks.OrderBy(pa => pa.SuccesRate).Last();

                var riskRate = 900;

                if (IsLastEnemyInContinent(turnManager, myAttack.Victim))
                {
                    riskRate = 400;
                }

                if (myAttack.SuccesRate < riskRate)
                {
                    return;
                }

                turnManager.Attack(myAttack.MyCountry, myAttack.Victim, myAttack.NumberOfTroops);
            }
        }
Exemple #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();
            }
        }