Exemplo n.º 1
0
        public void Test_Sync()
        {
            int        nodesCount = 1 + 4 + 4 * 4 + 4 * 4 * 4;
            int        idx;
            TestUfTree ufTree = new TestUfTree(nodesCount);

            idx = 0;
            CreateTestUfTree(ufTree, ref idx, 0, 3, 4);


            TestUniNode uniRoot = new TestUniNode();

            idx = 0;
            CreateTestUniTree(uniRoot, ref idx, 0, 3, 4);

            string userData = "bla";

            SyncUniAndUF <int> .Sync(uniRoot, ufTree, Sync, userData);
        }
Exemplo n.º 2
0
            public ChanceTree ConvertToChanceTree()
            {
                int depth = PlayersCount * RoundsCount;

                int nodesCount = CountNodes <int> .Count(Root, Root as object);

                ChanceTree ct = new ChanceTree(nodesCount);

                ct.SetNodesMemory(0); // To clear results.

                SyncUniAndUF <int> .Sync(Root, Root as object, ct, SyncNodes);

                WalkUFTreePP <ChanceTree, WalkUFTreePPContext> wt = new WalkUFTreePP <ChanceTree, WalkUFTreePPContext>();

                wt.OnNodeEnd = FinalizeChanceTree_OnNodeEnd;
                wt.Walk(ct);
                ct.PlayersCount        = PlayersCount;
                ct.Version.Description = String.Format("Chance tree (MC:{0:0,0}, {1})", SamplesCount, SourceInfo);
                return(ct);
            }