Пример #1
0
    // Use this for initialization
    void Start()
    {
        ga = new GeneticAlgorithm();
        int totalWeights = 5 * 8 + 8 * 2 + 8 + 2;
        ga.GeneratePopulation(15, totalWeights);
        currentFitness = 0.0f;
        bestFitness = 0.0f;

        net = new NeuralNetwork(1, 5, 8, 2);
        Genome genome = ga.GetNextGenome();
        net.FromGenome(genome, 5, 8, 2);

        testAgent = gameObject.GetComponent<Agent>();
        testAgent.Attach(net);

        hit = gameObject.GetComponent<CheckpointHit>();
        checkpointsNum = hit.checkpoints;
        defaultpos = transform.position;
        defaultrot = transform.rotation;
    }