Пример #1
0
    private List <int> SetMask()
    {
        actionList.Clear();

        if (gridWorld.GetRight(agentPosIdx) == -1)
        {
            SetActionMask(right);
        }
        else
        {
            actionList.Add(right);
        }

        if (gridWorld.GetLeft(agentPosIdx) == -1)
        {
            SetActionMask(left);
        }
        else
        {
            actionList.Add(left);
        }

        if (gridWorld.GetUp(agentPosIdx) == -1)
        {
            SetActionMask(up);
        }
        else
        {
            actionList.Add(up);
        }

        if (gridWorld.GetDown(agentPosIdx) == -1)
        {
            SetActionMask(down);
        }
        else
        {
            actionList.Add(down);
        }

        if (gridWorld.GetRightUp(agentPosIdx) == -1)
        {
            SetActionMask(rightUp);
        }
        else
        {
            actionList.Add(rightUp);
        }

        if (gridWorld.GetLeftUp(agentPosIdx) == -1)
        {
            SetActionMask(leftUp);
        }
        else
        {
            actionList.Add(leftUp);
        }

        if (gridWorld.GetRightDown(agentPosIdx) == -1)
        {
            SetActionMask(rightDown);
        }
        else
        {
            actionList.Add(rightDown);
        }

        if (gridWorld.GetLeftDown(agentPosIdx) == -1)
        {
            SetActionMask(leftDown);
        }
        else
        {
            actionList.Add(leftDown);
        }

        //None
        if (actionList.Count == 0)
        {
            actionList.Add(none);
        }
        else
        {
            SetActionMask(none);
        }

        return(actionList);
    }