public void Attack(TurnManager turnManager) { var country = GetRandomOwnedCountryThatCanAttack(turnManager); var countryToAttack = GetRandomAdjacentCountryToAttack(turnManager, country); turnManager.Attack(country, countryToAttack, country.NumberOfTroops - 1); }
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); }
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); } }
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(); } }