//Used to generate children for child classes of the Chromosome class public Chromosome MakeChild(Chromosome mate, int mutationAmount) { Chromosome newChromosome = CrossOver(mate); for (int i = 0; i < mutationAmount; ++i) { newChromosome.Mutate(); } newChromosome.Reheat(); return(newChromosome); }
public void BuildFromParents(SpawnerGroup mum, SpawnerGroup dad) { if (mum == null || dad == null) { return; } m_chromosome = mum.m_chromosome.MakeChild(dad.m_chromosome, m_mutationsPerReproduction); m_chromosome.Mutate(m_mutationsPerReproduction); m_chromosome.Reheat(); for (int i = 0; i < m_spawners.Length; ++i) { m_spawners[i].Gene = m_chromosome.Genes[i]; } m_chromosome.PrintData(); }
public void BuildFromParents(SpawnerGroup mum, SpawnerGroup dad) { if (mum == null || dad == null) return; m_chromosome = mum.m_chromosome.MakeChild(dad.m_chromosome, m_mutationsPerReproduction); m_chromosome.Mutate(m_mutationsPerReproduction); m_chromosome.Reheat(); for (int i = 0; i < m_spawners.Length; ++i) m_spawners[i].Gene = m_chromosome.Genes[i]; m_chromosome.PrintData(); }