Exemple #1
0
        public void RemoveDeadIndividuals()
        {
            DeadCarnivores += Carnivores.Where(i => !i.IsAlive).Count();
            DeadHerbivores += Herbivores.Where(i => !i.IsAlive).Count();
            List <Herbivore> survivingHerbivores = new List <Herbivore>();

            foreach (var herb in Herbivores)
            {
                if (herb.IsAlive)
                {
                    survivingHerbivores.Add(herb);
                }
            }

            List <Carnivore> survivingCarnivores = new List <Carnivore>();

            foreach (var carn in Carnivores)
            {
                if (carn.IsAlive)
                {
                    survivingCarnivores.Add(carn);
                }
            }
            Herbivores = survivingHerbivores;
            Carnivores = survivingCarnivores;
        }
Exemple #2
0
        public int ResetMigrationParameter()
        {
            var migrations = Carnivores.Where(i => i.Migrated).Count() + Herbivores.Where(i => i.Migrated).Count();

            Carnivores.ForEach(i => i.Migrated = false);
            Herbivores.ForEach(i => i.Migrated = false);
            return(migrations);
        }
Exemple #3
0
        public int ResetGivenBirthParameter()
        {
            var births = Carnivores.Where(i => i.GivenBirth).Count() + Herbivores.Where(i => i.GivenBirth).Count();

            Carnivores.ForEach(i => i.GivenBirth = false);
            Herbivores.ForEach(i => i.GivenBirth = false);
            return(births);
        }