Example #1
0
        public GameToPgnEnumerator(MoveTreeNode <PostMoveState> initial) : base(initial)
        {
            var startingNode = (MoveTreeNode <PostMoveState>)initial.Clone();

            if (startingNode.Value.MoveValue == Move.NullMove && startingNode.Continuations.Any())
            {
                startingNode = startingNode.Next;
            }

            Initial = (MoveTreeNode <PostMoveState>)startingNode.Clone();

            Reset();
        }
Example #2
0
        public PgnNode(MoveTreeNode <PostMoveState> treeNode)
        {
            Debug.Assert(treeNode != null);

            var node = (MoveTreeNode <PostMoveState>)treeNode.Clone();

            VariationDepth = treeNode.VariationDepth;
            Value          = node;
            if (!node.IsFirstMoveOfVariation)
            {
                SiblingNodes = node.GetSiblingVariations().Select(x => new PgnNode(x)).ToArray();
            }

            Next = node.Continuations.Any()
                ? new PgnNode((MoveTreeNode <PostMoveState>)node.Continuations.First())
                : null;
        }