protected Gene[] getCrossoverGenes(GeneString otherSource, bool keepLength)
        {
            Gene[] otherGenes = otherSource.getGenes();

            int maxCut = Math.Min(genes.Length, otherGenes.Length);

            int cutPoint1 = SharedRandom.Next(maxCut);
            int cutPoint2 = (keepLength) ? cutPoint1 : SharedRandom.Next(maxCut);

            Gene[] newGenes = new Gene[cutPoint1 + otherGenes.Length - cutPoint2];

            for (int n = 0; n < cutPoint1; n++)
            {
                newGenes[n] = genes[n].copy();
            }
            for (int n = 0; n < otherGenes.Length - cutPoint2; n++)
            {
                newGenes[n + cutPoint1] = otherGenes[n + cutPoint2].copy();
            }

            return newGenes;
        }
 public void setGene(int index, Gene gene)
 {
     genes[index] = gene;
 }