Example #1
0
        public void Swap(Individual remove,
                         Individual add)
        {
            if (remove.Type == IndividualType.Cooperator)
            {
                CooperatorGroup.Remove(remove);
            }
            else
            {
                DefectorGroup.Remove(remove);
            }

            if (add.Type == IndividualType.Cooperator)
            {
                CooperatorGroup.Add(add);
            }
            else
            {
                DefectorGroup.Add(add);
            }

            var index = AllIndividuals.IndexOf(remove);

            AllIndividuals[index] = add;
        }
Example #2
0
        public bool Remove(Individual individual)
        {
            AllIndividuals.Remove(individual);
            if (individual.Type == IndividualType.Cooperator)
            {
                return(CooperatorGroup.Remove(individual));
            }

            return(DefectorGroup.Remove(individual));
        }