public void Check_Calculate_Output() { float node2 = ActivationFunction.sigmoid(1f * -0.9f) + ActivationFunction.sigmoid(1f * 0.9f); float node3 = ActivationFunction.sigmoid(node2 * 0.1f) + ActivationFunction.sigmoid(1f * -0.1f); float expectedOutput = ActivationFunction.sigmoid(node3 * 0.2f); float actualOutput = genome.calculateOutput(1f, 1f); Assert.AreEqual(expectedOutput, actualOutput); }
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(); } }