public IList<IGenom> Mutation(IGenom[] entities) { var result = new List<IGenom>(entities); foreach (var entity in entities.OfType<BinaryGenom>()) { string x_mutant = BinaryСhromosome.Mutate(entity.X.Code); string y_mutant = BinaryСhromosome.Mutate(entity.Y.Code); if (x_mutant != null || y_mutant != null) { result.Add(new BinaryGenom( x_mutant == null ? entity.X : new BinaryСhromosome(x_mutant), y_mutant == null ? entity.Y : new BinaryСhromosome(y_mutant), EntityType.Mutant)); } } return result; }
public IList<IGenom> NexGeneration(IGenom partner) { var binatyPartner = (BinaryGenom)partner; var entities = Crossig(binatyPartner.Code); return Mutation(entities); }