Пример #1
0
    void SetNode(TreeNode tree)
    {
        LinkedListNode <Action> node = tree.First;

        while (node != null)
        {
            if (node.Value.Type.Equals("SZ"))
            {
                if (tree.Parent == null)
                {
                    //int num = 9;
                    if (int.TryParse(node.Value.Arg, out size))
                    {
                        Debug.Log(size);
                        GenerateBoard(size);
                        break;
                    }
                }
            }
            node = node.Next;
        }
        node = tree.First;
        Action action = null;

        while (node != null)
        {
            action = node.Value;
            if (action.Type.Equals("B"))
            {
                //setaction(n, a, 1);
            }
            else if (action.Type.Equals("W"))
            {
                //setaction(n, a, -1);
            }
            if (action.Type.Equals("AB"))
            {
                //placeaction(n, a, 1);
            }
            if (action.Type.Equals("AW"))
            {
                //placeaction(n, a, -1);
            }
            else if (action.Type.Equals("AE"))
            {
                //emptyaction(n, a);
            }
            node = node.Next;
        }
    }
Пример #2
0
    public void SetAction(TreeNode node, Action action, int c)
    // interpret a set move action, update the last move marker,
    // c being the color of the move.
    {
        int i, j;
        LinkedListNode <string> arg = action.Args;

        while (arg != null)
        {
            String s = arg.Value;
            i = Field.i(s);
            j = Field.j(s);
            if (Valid(i, j))
            {
                GenerateStone(i, j, c);
                //n.addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
                //P.color(i, j, c);
                //update(i, j);
            }
            arg = arg.Next;
        }
    }