public void AddMessageToBallot(Kingdom sender, Kingdom receiver, string message) { if (!CompetingKingdom.Contains(receiver)) { BallotBox.Add(BallotMessage.Create(sender, receiver, message)); } }
private void StartElection() { AddMessageToBallotRandomly(); ReadOnlyCollection <BallotMessage> rndMessages = BallotBox.GetRandomNBallotMessgae(PickNRandomMessage); BallotBox.SendMessageToKingdom(rndMessages); RecordRoundsResult(); }
public void ReElectionSetup() { Round++; if (IsTie()) { CompetingKingdom = GetTiedQuery().OrderByDescending(x => x.Key).First().ToList(); } CompetingKingdom.ForEach(Kingdom => Kingdom.ClearAllies()); BallotBox.Clear(); }
public BallotSystem(List <Kingdom> competingKingdom, List <Kingdom> allKingDoms, RandomizeMessage randomizeMessage, int pickNRandomMessage) { CompetingKingdom = competingKingdom.Distinct().ToList(); AllKingDoms = allKingDoms.Except(CompetingKingdom).ToList(); BallotBox = new BallotBox(); RoundResults = new Dictionary <string, List <string> >(); RandomizeMessage = randomizeMessage; PickNRandomMessage = pickNRandomMessage; Round = 1; }
public void SendMessageToKingdom() { BallotBox.SendMessageToKingdom(BallotBox.GetBallotMessgae()); }
public int BallotMessageCount() { return(BallotBox.GetBallotMessageCount()); }