public void ScheduleFullAttack(Region attacker, Region target, int armiesDeployed) { // validate our inputs if (!attacker.OwnedByPlayer(MyPlayerName) || target.OwnedByPlayer("unknown") || target.OwnedByPlayer(MyPlayerName)) { // there must have been an error somewhere on the algo Console.Error.WriteLine("trying to schedule a full attack with invalid inputs (on round " + RoundNumber + ")"); return; } // count total armies available int totalArmies = attacker.Armies + attacker.PledgedArmies - attacker.ReservedArmies + armiesDeployed - 1; attacker.PledgedArmies += armiesDeployed; attacker.ReservedArmies += totalArmies; scheduledAttack.Add(new Tuple<int, int, int>(attacker.Id, target.Id, totalArmies)); }
public int ScheduleNeutralAttack(Region attacker, Region target, int armiesAvailable) { int usedArmies = 0; // validate our inputs if (!attacker.OwnedByPlayer(MyPlayerName) || target.OwnedByPlayer("unknown") || target.OwnedByPlayer(MyPlayerName) || armiesAvailable < 0) { // there must have been an error somewhere on the algo Console.Error.WriteLine("trying to schedule a neutral attack with invalid inputs (on round " + RoundNumber + ")"); return 0; } // armies needed to attack neutral int neededToAttack = target.Armies * 2; int neededToDeploy = neededToAttack - attacker.Armies - attacker.PledgedArmies + attacker.ReservedArmies + 1; if (neededToDeploy > armiesAvailable + 1) { // there must have been an error somewhere on the algo Console.Error.WriteLine("trying to schedule a neutral attack without enough armies to carry it through (on round " + RoundNumber + ")"); return 0; } if (neededToDeploy < 0) { neededToDeploy = 0; } attacker.PledgedArmies += neededToDeploy; usedArmies += neededToDeploy; attacker.ReservedArmies += neededToAttack; scheduledAttack.Add(new Tuple<int, int ,int>(attacker.Id, target.Id, neededToAttack)); attackedOneNeutral = true; return usedArmies; }
public void ScheduleAttack(Region attacker, Region target, int deployArmies, int attackArmies) { // validate our inputs if (!attacker.OwnedByPlayer(MyPlayerName) || target.OwnedByPlayer("unknown") || target.OwnedByPlayer(MyPlayerName)) { // there must have been an error somewhere on the algo Console.Error.WriteLine("trying to schedule an attack with invalid inputs (on round " + RoundNumber + ")"); return; } attacker.PledgedArmies += deployArmies; attacker.ReservedArmies += attackArmies; scheduledAttack.Add(new Tuple<int, int, int>(attacker.Id, target.Id, attackArmies)); }