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

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