Example #1
0
        public GoNode AddNode(GoNode nextNode)
        {
            ChildNodes.Add(nextNode);
            DefaultChildNode = nextNode;

            return(nextNode);
        }
Example #2
0
 public void PlaceStone(Stone stone, bool storeBoard)
 {
     currentNode = currentNode.AddNode(new GoMoveNode(currentNode, stone, storeBoard));
     MoveNumber  = MoveNumber + 1;
     if (updateBoard)
     {
         board.Place(stone);
     }
 }
Example #3
0
 public void AddNode(GoNode node)
 {
     currentNode = currentNode.AddNode(node);
     MoveNumber  = MoveNumber + 1;
     if (updateBoard)
     {
         board = currentNode.BoardCopy;
     }
 }
Example #4
0
        public GoGame(byte boardSize)
        {
            currentNode  = new GoRootNode(boardSize);
            MoveNumber   = 0;
            Info         = new GameInfo();
            ShowVariants = Variants.Siblings;

            board = new Board(boardSize);
        }
Example #5
0
 public void SetHandicap(byte count)
 {
     if (currentNode is GoRootNode)
     {
         currentNode = currentNode.AddNode(new GoSetupNode(currentNode));
         (currentNode as GoSetupNode).SetHandicap(count);
         MoveNumber = MoveNumber + 1;
         board      = currentNode.BoardCopy;
     }
 }
Example #6
0
 public void RemoveNode(GoNode node)
 {
     ChildNodes.Remove(node);
     if (node == DefaultChildNode)
     {
         DefaultChildNode =
             ChildNodes.Count > 0
                 ? ChildNodes[0]
                 : null;
     }
 }
Example #7
0
 public bool ToPreviousMove(bool updateBoard)
 {
     if (currentNode.ParentNode != null)
     {
         currentNode = currentNode.ParentNode;
         MoveNumber  = MoveNumber - 1;
         if (updateBoard)
         {
             board = currentNode.BoardCopy;
         }
         return(true);
     }
     return(false);
 }
Example #8
0
 public void ToMove(GoNode node)
 {
     foreach (var child in currentNode.ChildNodes)
     {
         if (child == node)
         {
             currentNode = node;
             MoveNumber += 1;
             if (updateBoard)
             {
                 board = currentNode.BoardCopy;
             }
         }
     }
 }
Example #9
0
 public GoNode(GoNode parentNode, bool makeBoards)
 {
     ChildNodes = new List <GoNode>();
     if (parentNode != null)
     {
         ParentNode = parentNode;
         if (makeBoards)
         {
             board = CopyParentBoard();
         }
     }
     else
     {
         ParentNode = null;
     }
 }
Example #10
0
 public bool ToNextMove(bool updateBoard)
 {
     if (currentNode.DefaultChildNode != null)
     {
         currentNode = currentNode.DefaultChildNode;
         MoveNumber  = MoveNumber + 1;
         if (updateBoard)
         {
             if (currentNode is GoMoveNode)
             {
                 board.Place((currentNode as GoMoveNode).Stone);
             }
             else
             {
                 board = currentNode.BoardCopy;
             }
         }
         return(true);
     }
     return(false);
 }
Example #11
0
 public void ToNextVariation()
 {
     currentNode = currentNode.GetNextSibling();
     board       = currentNode.BoardCopy;
 }
Example #12
0
 public void ToPreviousVariation()
 {
     currentNode = currentNode.GetPreviousSibling();
     board       = currentNode.BoardCopy;
 }