Пример #1
0
        public void AddChildren(List <GameTurn> remainingTurns)
        {
            var copyRemainingTurns = CopyOfRemainingTurns(remainingTurns);

            if (copyRemainingTurns.Count == 0)
            {
                return;
            }

            var childTurn = copyRemainingTurns[0];

            copyRemainingTurns.Remove(childTurn);

            for (int i = 0; i < childTurn.Hints.Count; i++)
            {
                var turn = new GameTurn();
                turn.PlayerMoves = new List <PlayerMove>();
                foreach (var origMove in childTurn.PlayerMoves)
                {
                    var newMove = origMove.Copy();
                    turn.PlayerMoves.Add(newMove);
                }
                turn.Hints = new List <PlayerMove>()
                {
                    childTurn.Hints[i]
                };

                var childNode = new GameTreeNode(turn);
                this.AddChild(childNode);
            }
            foreach (var childNode in this.Children)
            {
                childNode.AddChildren(copyRemainingTurns);
            }
        }
Пример #2
0
 public void BuildTree()
 {
     rootNode = new GameTreeNode(initialTurn);
     rootNode.AddChildren(turns);
 }
Пример #3
0
 public void AddChild(GameTreeNode child)
 {
     this.Children.Add(child);
 }