예제 #1
0
 public void AddMessageToBallot(Kingdom sender, Kingdom receiver, string message)
 {
     if (!CompetingKingdom.Contains(receiver))
     {
         BallotBox.Add(BallotMessage.Create(sender, receiver, message));
     }
 }
예제 #2
0
        private void StartElection()
        {
            AddMessageToBallotRandomly();
            ReadOnlyCollection <BallotMessage> rndMessages = BallotBox.GetRandomNBallotMessgae(PickNRandomMessage);

            BallotBox.SendMessageToKingdom(rndMessages);
            RecordRoundsResult();
        }
예제 #3
0
 public void ReElectionSetup()
 {
     Round++;
     if (IsTie())
     {
         CompetingKingdom = GetTiedQuery().OrderByDescending(x => x.Key).First().ToList();
     }
     CompetingKingdom.ForEach(Kingdom => Kingdom.ClearAllies());
     BallotBox.Clear();
 }
예제 #4
0
 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;
 }
예제 #5
0
 public void SendMessageToKingdom()
 {
     BallotBox.SendMessageToKingdom(BallotBox.GetBallotMessgae());
 }
예제 #6
0
 public int BallotMessageCount()
 {
     return(BallotBox.GetBallotMessageCount());
 }