internal DNA Clone() { DNA dna = new DNA(Grid, false); Genes.CopyTo(dna.Genes, 0); dna.Fitness = Fitness; dna.Nuisance = Nuisance; return(dna); }
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); } } }
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); } } }