Exemplo n.º 1
0
        public override Gene copy()
        {
            ByteGene gene = new ByteGene(maxValue);

            gene.setValue(value);

            return gene;
        }
Exemplo n.º 2
0
        public ByteGeneString(int numGenes, byte geneSize, bool randomize)
        {
            if (!ByteGene.isValidMaxValue(geneSize)) throw new OutOfBoundsException(geneSize + " is not a valid size for a gene");

            genes = new ByteGene[numGenes];

            for (int n = 0; n < numGenes; n++)
            {
                ByteGene newGene = new ByteGene(geneSize);

                if (randomize) newGene.setValue((byte) SharedRandom.Next(geneSize));
                genes[n] = newGene;
            }
        }