Exemplo n.º 1
0
            internal DNA Clone()
            {
                DNA dna = new DNA(Grid, false);

                Genes.CopyTo(dna.Genes, 0);
                dna.Fitness  = Fitness;
                dna.Nuisance = Nuisance;
                return(dna);
            }
Exemplo n.º 2
0
    public void Mutate(int mutationRate)
    {
        float[] newGenes = new float[5];
        Genes.CopyTo(newGenes, 0);

        for (int i = 0; i < Genes.Length; i++)
        {
            if (UnityEngine.Random.Range(0, UnityEngine.Mathf.Abs(mutationRate)) > 1)
            {
                Genes[i] = getRandomGene(i);
            }
        }
    }
Exemplo n.º 3
0
    public void Mutate(float mutationRate)
    {
        float[] newGenes = new float[6];
        Genes.CopyTo(newGenes, 0);

        for (int i = 0; i < Genes.Length; i++)
        {
            if (UnityEngine.Random.value < mutationRate)
            {
                Genes[i] = getRandomGene(i);
            }
        }
    }