public FlopRoot(Node Parent, CommunityNode Community, int Spent, int Pot, int RootCount)
     : base(Parent, Community, Spent, Pot, RootCount)
 {
     #if DEBUG
     InstanceCount++;
     #endif
 }
        public CommunityNode(CommunityNode Parent)
        {
            this.Parent = Parent;

            #if DEBUG
            InstanceCount++;
            #endif
        }
        public Junction(Node parent, CommunityNode Community, int Spent, int Pot)
            : base(parent, Spent, Pot)
        {
            Weight = 0;

            this.Spent = Spent;
            this.Pot = Pot;
            Assert.That(Spent == Pot);

            MyCommunity = Community;
            Phase = MyCommunity.Phase;

            Initialize();
        }
        public PhaseRoot(Node Parent, CommunityNode Community, int Spent, int Pot, int RootCount)
            : base(Parent, Spent, Pot)
        {
            MyPhaseRoot = this;
            MyCommunity = Community;

            Weight = MyCommunity.Weight;
            Phase = MyCommunity.Phase;
            InitiallyActivePlayer = MyCommunity.InitiallyActivePlayer;

            DataOffset = MaxDepth + RootCount;
            if (Phase == BettingPhase.Turn) DataOffset += Flop.N;
            if (Phase == BettingPhase.River) DataOffset += Flop.N + Card.N;

            Initialize();
        }
        public void ChanceToActPrecomputation(PocketData pdf, PocketData chance, CommunityNode community)
        {
            ResetTotal();

            number val, mass;
            Pocket pocket;
            for (int p = 0; p < Pocket.N; p++)
            {
                if (!community.AvailablePocket[p]) continue;

                mass = pdf[p];
                val = mass * chance[p];
                TotalChance += val;
                TotalMass += mass;

                pocket = Pocket.Pockets[p];
                int c1 = pocket.Cards[0], c2 = pocket.Cards[1];
                TotalChance_OneCardFixed[c1] += val;
                TotalChance_OneCardFixed[c2] += val;
                TotalMass_OneCardFixed[c1] += mass;
                TotalMass_OneCardFixed[c2] += mass;
            }
        }
        public void ProbabilityPrecomputation(PocketData pdf, CommunityNode community)
        {
            ResetMass();

            number mass;
            Pocket pocket;
            for (int p = 0; p < Pocket.N; p++)
            {
                if (!community.AvailablePocket[p]) continue;

                mass = pdf[p];
                TotalMass += mass;

                pocket = Pocket.Pockets[p];
                int c1 = pocket.Cards[0], c2 = pocket.Cards[1];
                TotalMass_OneCardFixed[c1] += mass;
                TotalMass_OneCardFixed[c2] += mass;
            }
        }
        /* This code is for dynamically generating file strings at save/load time instead of always keeping the file names in memory.
        protected string FileString()
        {
            var ParentString = Parent.FileString();
            var MyAddtionalString = FileStringBit();

            if (ParentString != null)
            {
                if (MyAddtionalString != null)
                    return ParentString + MyAddtionalString;
                else
                    return ParentString;
            }
            else
            {
                if (MyAddtionalString != null)
                    return MyAddtionalString;
                else
                    return null;
            }
        }

        protected virtual string FileStringBit()
        {
            return null;
        }
         * */
        public Node(Node parent, int Spent, int Pot)
        {
            Parent = parent;

            if (Parent == null)
                BetCode = null;
            else
                BetCode = Parent.BetCode;

            if (Parent != null)
            {
                MyPhaseRoot = Parent.MyPhaseRoot;
                MyCommunity = Parent.MyCommunity;
                Depth = Parent.Depth + 1;
            }
            else
            {
                MyPhaseRoot = null;
                MyCommunity = null;
                Depth = 0;
            }

            DataOffset = Depth;

            this.Spent = Spent;
            this.Pot = Pot;
        }