コード例 #1
0
    public override void AgentStep(float[] act)
    {
        int action = (int)act[0];


        if (action == 1)
        {
            shipController.MoveLeft();
        }
        else
        {
            shipController.turnOffRightFire();
        }
        if (action == 2)
        {
            shipController.MoveRight();
        }
        else
        {
            shipController.turnOffLeftFire();
        }
        if (action == 3)
        {
            shipController.MoveUp();
        }
        else
        {
            shipController.turnOffCentralFire();
        }
        if (action == 4)
        {
            shipController.MoveLeft();
            shipController.MoveUp();
        }
        else
        {
            shipController.turnOffRightFire();
            shipController.turnOffCentralFire();
        }
        if (action == 5)
        {
            shipController.MoveRight();
            shipController.MoveUp();
        }
        else
        {
            shipController.turnOffLeftFire();
            shipController.turnOffCentralFire();
        }

        if (gameManager.won)
        {
            reward += 1;
            done    = true;
        }
        else if (gameManager.lost)
        {
            reward -= 1;
            done    = true;
        }
        else
        {
            //reward -= 0.005f;
        }
    }