private List <Individual> EvolveOnce() { var newPopulation = new ConcurrentBag <Individual>(); Parallel.For(0, population.Count / 2, _ => //for (var i = 0; i < population.Count / 2; i++) { var father = GetWeightedChoice(); var mother = GetWeightedChoice(); var split = Rand.Next(Dna.Length); var brother = new Dna(father.Take(split).Concat(mother.Skip(split)) .Select(x => Rand.NextDouble() < 0.001 ? MoveHelpers.GetRandomMove() : x) .ToArray()); var sister = new Dna(mother.Take(split).Concat(father.Skip(split)) .Select(x => Rand.NextDouble() < 0.001 ? MoveHelpers.GetRandomMove() : x) .ToArray()); newPopulation.Add(new Individual(brother, fitnessFunc(brother))); newPopulation.Add(new Individual(sister, fitnessFunc(sister))); }); return(newPopulation.ToList()); }