private void BotInputWithBallKick(PlayerInput input) { float[] kickingNeuralNetInput = ExtractorWithBall.Extract(this); float[] kickingNeuralNetOutput = KickingBallNeuralNet.Think(kickingNeuralNetInput); input.MouseLeftPressed = kickingNeuralNetOutput[0] > 0.0f; if (Team == Team.Away) { kickingNeuralNetOutput[1] *= -1; kickingNeuralNetOutput[2] *= -1; } if (input.MouseLeftPressed) { input.mousePosition = new Vector2( kickingNeuralNetOutput[1] * KICING_BALL_OUTPUT_MULTIPLIER - transform.position.x, kickingNeuralNetOutput[2] * KICING_BALL_OUTPUT_MULTIPLIER - transform.position.y); } }
public void LoadFromDisc(string path) { MovingNeuralNet.Load(Path.Combine(path, MOVING_NEURAL_NET)); MovingWithBallNeuralNet.Load(Path.Combine(path, MOVING_WITH_BALL_NEURAL_NET)); KickingBallNeuralNet.Load(Path.Combine(path, KICKING_BALL_NEURAL_NET)); }
public void SaveTodisc(string path) { MovingNeuralNet.Save(Path.Combine(path, MOVING_NEURAL_NET)); MovingWithBallNeuralNet.Save(Path.Combine(path, MOVING_WITH_BALL_NEURAL_NET)); KickingBallNeuralNet.Save(Path.Combine(path, KICKING_BALL_NEURAL_NET)); }