Ejemplo n.º 1
0
        /// <summary>
        /// Called on each node.
        /// </summary>
        /// <param name="n">Current node. To skip children, set it to nextNode - 1 (because it will be incremented).</param>
        void BestResponseFinalize_OnNode(PlayerTree tree, ref UInt32 n, int d)
        {
            Node *pNode = tree.Nodes + n;
            int   pos   = pNode->Position;

            if (pos == _heroPos)
            {
                // This var belongs to BR (otherwise we would have skipped it).
                pNode->StrVar++;
            }
            if (pNode->Position == _playersCount)
            {
                // Dealer node
                _brfStack[d].ChanceId = pNode->ChanceId;
            }
            else if (d > _playersCount)
            {
                _brfStack[d].ChanceId = _brfStack[d - 1].ChanceId;
            }

            if (pNode->IsHeroActing)
            {
                WalkTreeWithSkipChildren(tree, pNode->BestBrNode);
                n = pNode->NextNodeToSkipChildren - 1;
            }
            else if (pNode->IsLeaf)
            {
                // This leaf belongs to BR (otherwise we would have skipped it).
                _finalBrLeavesCount++;
                QueueIncrementGameValueJob(_brfStack[d].ChanceId, pNode->AtIdx);
            }
        }
 public void Setup()
 {
     rootNode = PlayerTree.MakeRootNode(rootNode);
 }