protected Chromosome CrossOver(Chromosome mate)
        {
            if (mate.ChromosomeData.Length != _chromosomeData.Length)
            {
                throw new InvalidOperationException("The two chromosomes must have the same length!");
            }
            Chromosome newChromosome = new Chromosome(this);

            int splitIndex = Globals.Random.Next(0, _chromosomeData.Length);

            bool[] newChromosomeData = new bool[_chromosomeData.Length];

            for (int i = 0; i < newChromosomeData.Length; ++i)
            {
                if (i < splitIndex)
                {
                    newChromosomeData[i] = _chromosomeData[i];
                }
                else
                {
                    newChromosomeData[i] = mate.ChromosomeData[i];
                }
            }

            newChromosome.ChromosomeData = newChromosomeData;
            newChromosome.Reheat();
            return(newChromosome);
        }
        //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();
        }
        protected Chromosome CrossOver(Chromosome mate)
        {
            if (mate.ChromosomeData.Length != _chromosomeData.Length)
                throw new InvalidOperationException("The two chromosomes must have the same length!");
            Chromosome newChromosome = new Chromosome(this);

            int splitIndex = Globals.Random.Next(0, _chromosomeData.Length);
            bool[] newChromosomeData = new bool[_chromosomeData.Length];

            for (int i = 0; i < newChromosomeData.Length; ++i)
                if (i < splitIndex)
                    newChromosomeData[i] = _chromosomeData[i];
                else
                    newChromosomeData[i] = mate.ChromosomeData[i];

            newChromosome.ChromosomeData = newChromosomeData;
            newChromosome.Reheat();
            return newChromosome;
        }