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

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