Ejemplo n.º 1
0
        void evaluateNetwork(List <float> xPosOfObstacles, List <float> heightsOfObstacles, NEATPlayerOne script, Genome robotController, ref int index)
        {
            if (script.transform.position.x > xPosOfObstacles[index])
            {
                index++;
            }

            // setting death position in genome
            robotController.setDistanceTravelled(script.getDeathPositionX());

            float output = robotController.calculateOutput(xPosOfObstacles[index] - script.transform.position.x, heightsOfObstacles[index]);

            if (output > 0.0 && script.getOnGround() && population.getGenerationCounter() > 1)
            {
                script.PlayerJump();
                robotController.addToJumpsMade();
            }
        }