예제 #1
0
 private void SetRoles()
 {
     HeadLeader = Population[0];
     for (int i = 1; i <= numberOfLocalLeaders; i++)
     {
         LocalLeaders.Add(Population[i]);
     }
     for (int i = numberOfAllParts - numberOfAimlessParts; i < numberOfAllParts; i++)
     {
         AimlessParticles.Add(Population[i]);
     }
     for (int i = numberOfLocalLeaders + 1; i < numberOfAllParts - numberOfAimlessParts; i++)
     {
         ExplorerParticles.Add(Population[i]);
     }
 }
예제 #2
0
        private void DiscardRoles()
        {
            int k = 1;

            Population[0] = HeadLeader;
            for (int i = 0; i < LocalLeaders.Count; i++)
            {
                Population[k] = LocalLeaders[i];
                k++;
            }
            LocalLeaders.Clear();
            for (int i = 0; i < ExplorerParticles.Count; i++)
            {
                Population[k] = ExplorerParticles[i];
                k++;
            }
            ExplorerParticles.Clear();
            for (int i = 0; i < AimlessParticles.Count; i++)
            {
                Population[k] = AimlessParticles[i];
                k++;
            }
            AimlessParticles.Clear();
        }