Пример #1
0
            public void Backpropagate(int score)
            {
                //Console.WriteLine("---------Back---------");
                int      currentPlayerID = Game.CurrentPlayer.PlayerId;
                TaskNode node            = this;

                // While the node has a parent, backpropagate the result of the simulation up the game tree
                while (node.Parent != null)
                {
                    if (node.Parent.Game.CurrentPlayer.PlayerId == currentPlayerID)
                    {
                        node.UpdateScore(score);
                    }
                    else
                    {
                        if (score == 0)
                        {
                            node.UpdateScore(1);
                        }
                        else
                        {
                            node.UpdateScore(0);
                        }
                    }
                    node = node.Parent;
                }
                node.TotNumVisits++;
            }
Пример #2
0
            public void Backpropagate(int score)
            {
                int      currentPlayerID = Game.CurrentPlayer.PlayerId;
                TaskNode node            = this;


                while (node.Parent != null)
                {
                    if (node.Parent.Game.CurrentPlayer.PlayerId == currentPlayerID)
                    {
                        node.UpdateScore(score);
                    }
                    else
                    {
                        if (score == 0)
                        {
                            node.UpdateScore(1);
                        }
                        else
                        {
                            node.UpdateScore(0);
                        }
                    }
                    node = node.Parent;
                }
                node.TotNumVisits++;
            }