public RiverCommunity(TurnCommunity Parent, Flop flop, int turn, int river)
            : base(Parent)
        {
            #if DEBUG
            InstanceCount++;
            #endif

            MyFlop = flop;
            MyTurn = turn;
            MyRiver = river;
            ClassifyAvailability();

            Weight = ((number)1) / (Card.N - 4 - 3 - 1);
            Phase = BettingPhase.River;
            InitiallyActivePlayer = Player.Dealer;

            // Get all pocket values
            PocketValue = new uint[Pocket.N];
            for (int p = 0; p < Pocket.N; p++)
            {
                //if (Collision(p))
                //    PocketValue[p] = 0;//uint.MaxValue;
                //else
                //    PocketValue[p] = Value.Eval(MyFlop, MyTurn, MyRiver, Pocket.Pockets[p]);
                if (AvailablePocket[p])
                    PocketValue[p] = Value.Eval(MyFlop, MyTurn, MyRiver, Pocket.Pockets[p]);
                else
                    PocketValue[p] = 0;//uint.MaxValue;
            }

            // Sort pockets
            SortedPockets = new int[Pocket.N];
            for (int i = 0; i < Pocket.N; i++) SortedPockets[i] = i;

            SortedPocketValue = new uint[Pocket.N];
            PocketValue.CopyTo(SortedPocketValue, 0);

            Array.Sort(SortedPocketValue, SortedPockets);

            MakeScratchSpace();
        }
        protected override void CreateBranches()
        {
            Branches = new List<CommunityNode>(Card.N - 3);
            BranchesByIndex = new List<CommunityNode>(Card.N);

            for (int turn = 0; turn < Card.N; turn++)
            {
                CommunityNode NewBranch;

                if (AvailableCard[turn])
                {
                    if (DerivedSetup.SuitReduce)
                    {
                        if (MyFlop.IsRepresentative())
                            NewBranch = new TurnCommunity(this, MyFlop, turn);
                        else
                            NewBranch = null;
                    }
                    else
                    {
                        NewBranch = new TurnCommunity(this, MyFlop, turn);
                    }

                    Branches.Add(NewBranch);
                }
                else
                    NewBranch = null;
                BranchesByIndex.Add(NewBranch);
            }
        }