Esempio n. 1
0
        public GoNode AddNode(GoNode nextNode)
        {
            ChildNodes.Add(nextNode);
            DefaultChildNode = nextNode;

            return(nextNode);
        }
Esempio n. 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);
     }
 }
Esempio n. 3
0
 public void AddNode(GoNode node)
 {
     currentNode = currentNode.AddNode(node);
     MoveNumber  = MoveNumber + 1;
     if (updateBoard)
     {
         board = currentNode.BoardCopy;
     }
 }
Esempio n. 4
0
        public GoGame(byte boardSize)
        {
            currentNode  = new GoRootNode(boardSize);
            MoveNumber   = 0;
            Info         = new GameInfo();
            ShowVariants = Variants.Siblings;

            board = new Board(boardSize);
        }
Esempio n. 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;
     }
 }
Esempio n. 6
0
 public void RemoveNode(GoNode node)
 {
     ChildNodes.Remove(node);
     if (node == DefaultChildNode)
     {
         DefaultChildNode =
             ChildNodes.Count > 0
                 ? ChildNodes[0]
                 : null;
     }
 }
Esempio n. 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);
 }
Esempio n. 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;
             }
         }
     }
 }
Esempio n. 9
0
 public GoNode(GoNode parentNode, bool makeBoards)
 {
     ChildNodes = new List <GoNode>();
     if (parentNode != null)
     {
         ParentNode = parentNode;
         if (makeBoards)
         {
             board = CopyParentBoard();
         }
     }
     else
     {
         ParentNode = null;
     }
 }
Esempio n. 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);
 }
Esempio n. 11
0
 public void ToNextVariation()
 {
     currentNode = currentNode.GetNextSibling();
     board       = currentNode.BoardCopy;
 }
Esempio n. 12
0
 public void ToPreviousVariation()
 {
     currentNode = currentNode.GetPreviousSibling();
     board       = currentNode.BoardCopy;
 }