Exemplo n.º 1
0
        static LC0VerboseMoveStat BuildStatNotExpanded(MCTSNode node, int childIndex)
        {
            MCTSNodeStructChild child = node.ChildAtIndexRef(childIndex);
            LC0VerboseMoveStat  stat  = new LC0VerboseMoveStat(null, null);

            stat.MoveString = child.Move.ToString();
            stat.MoveCode   = child.Move.IndexNeuralNet;
            stat.P          = child.P * 100.0f;
            stat.U          = node.ChildU(childIndex);
            return(stat);
        }
        internal static void Repack(MCTSNode node, ref CompressedPolicyVector policy)
        {
            Span <ushort> indicies      = stackalloc ushort[node.NumPolicyMoves];
            Span <ushort> probabilities = stackalloc ushort[node.NumPolicyMoves];

            for (int i = 0; i < node.NumPolicyMoves; i++)
            {
                ref MCTSNodeStructChild childRef = ref node.ChildAtIndexRef(i);
                indicies[i]      = (ushort)childRef.Move.IndexNeuralNet;
                probabilities[i] = CompressedPolicyVector.EncodedProbability(childRef.P);
            }