示例#1
0
    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);
        }
    }
示例#2
0
 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));
 }
示例#3
0
 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));
 }