Exemple #1
0
    // Q学習用
    public override int GetState()
    {
        int r = 0;

        MalletControllers.ForEach(h =>
        {
            r = r * 9 + h.GetState();
        });

        Pucks.Select(puck => puck.GetComponent <Puck>()).ToList()
        .ForEach(b => r = r * 9 + b.GetState(MalletControllers.Select(h => h.transform).ToList()));
        return(r);
    }
Exemple #2
0
    //エージェントの初期化
    public override void AgentReset()
    {
        CurrentStep    = 0;
        CurrentStepMax = 1000;

        CollisionNum = 0;
        gameObject.SetActive(false);
        gameObject.SetActive(true);

        MalletControllers.ForEach(x => x.ResetParams());
        Pucks.ForEach(b => b.GetComponent <Puck>().ResetParams());
        RewardList = new List <float>()
        {
            0, 0
        };
    }
Exemple #3
0
    //(NE)状態を取得する
    public override List <double> CollectObservations()
    {
        var observations = new List <double>();

        MalletControllers.ForEach(x =>
        {
            observations.Add(x.RB.position.x - MyPosition.x);
            observations.Add(x.RB.position.z - MyPosition.z);
        });
        Pucks.OrderBy(x => x.position.x).ToList().ForEach(x =>
        {
            observations.Add(x.position.x - MyPosition.x);
            observations.Add(x.position.z - MyPosition.z);
            observations.Add(x.velocity.x);
            observations.Add(x.velocity.z);
        });
        return(observations);
    }
Exemple #4
0
 public override void Stop()
 {
     MalletControllers.ForEach(x => x.Velocity = Vector3.zero);
 }