MZ.GeneticSimulation.DataModel.World.SelectBest C# (CSharp) Method

SelectBest() private method

Selects best creatures.
private SelectBest ( ) : void
return void
        private void SelectBest()
        {
            var allCreatures = new List<Creature>(this.Species.Sum(kind => kind.Count));
            allCreatures.AddRange(this.Species.SelectMany(kind => kind));
            allCreatures =
                allCreatures.OrderByDescending(creature => creature.SummaryStrength)
                    .Take(allCreatures.Count >> 1)
                    .ToList();
            for (var i = 0; i < this.Species.Length; i++)
            {
                this.Species[i].ForEach(creature => creature.BreakRedundantConnections());
                this.Species[i].Clear();
                this.Species[i].AddRange(allCreatures.Where(creature => creature.IdOfSpecies == i));
            }
        }