// tie // ruler public Kingdom DecideRuler() { //unique max allies value // if two or more have max values then null; int maxAllies = 0; foreach (var kingdomName in this.map.Keys) { maxAllies = Math.Max(map[kingdomName].Allies.Count, maxAllies); } int count = 0; Kingdom ruler = null; foreach (var kingdomName in this.map.Keys) { if (map[kingdomName].Allies.Count == maxAllies) { ruler = map[kingdomName]; count++; } } return(count == 1 ? ruler : null); }
public bool DecideRuler(Kingdom kingdom) { if (kingdom.Allies.Count < this.minimunAllies) { return(false); } return(true); }