Exemple #1
0
        public ZeldaGenome(ZeldaConfiguration configuration)
        {
            this.configuration = configuration;

            // add some more genes
            int count = configuration.CalcNumInitialGenes();

            this.genes = GeneUtils.Generate(count, factory, configuration);
        }
Exemple #2
0
        public Genome Mutate(RandomNumberGenerator random)
        {
            // mutate genes
            var newGenes = new List <ZeldaGene>(genes);

            GeneUtils.Mutate(newGenes, factory, configuration);

            // assemble offspring
            return(new ZeldaGenome(configuration, newGenes));
        }
Exemple #3
0
        public Pair <Genome> Crossover(Genome o, RandomNumberGenerator random)
        {
            ZeldaGenome other = (ZeldaGenome)o;

            // randomly distribute genes
            var newGenesA = new List <ZeldaGene>(genes);
            var newGenesB = new List <ZeldaGene>(other.genes);

            GeneUtils.Crossover(genes, other.genes, random);

            // assemble offsprings
            var a = new ZeldaGenome(configuration, newGenesA);
            var b = new ZeldaGenome(configuration, newGenesB);

            return(new Pair <Genome>(a, b));
        }