示例#1
0
        public void TestTruthTable()
        {
            var neat = new Brain.Neat.Neat();
            var ne   = new NeuroEvolution(neat);

            var bodies = new List <IBody>();

            // population size is 10
            for (int i = 0; i < 10; i++)
            {
                bodies.Add(new Body());
            }

            var champ = ne.Begin(bodies);

            for (var i = 0; i < 100; i++)
            {
                Console.WriteLine("Champ fitness: " + champ.CalculateRawFitness());
                champ = ne.Epoch();
            }
        }
示例#2
0
    // Use this for initialization

    void Awake()
    {
        neuro = new NeuroEvolution(13, new int[] { 8 }, 2);

        NeuroEvolution.elitism         = elitism;
        NeuroEvolution.mutationRate    = mutationRate;
        NeuroEvolution.randomBehaviour = randomBehaviour;

        Generation nextGeneration = neuro.nextGeneration();

        currentGeneration = nextGeneration;
        List <Genome> genomes = nextGeneration.getGenomes();

        currentGenomes = genomes;
        currentGenome  = genomes[currentGenomeIndex];

        genomeText.text     = "Genome 1";
        generationText.text = "Generation 1";
        diversityText.text  = "Diversity: " + currentGeneration.diversity;

        listener = new UnityAction(GameOver);
    }