Ejemplo n.º 1
0
        private void UpdateHand(StrategicState next, int position, int card)
        {
            int handSize = next.Hands[position].Length;

            Array.Resize(ref next.Hands[position], handSize + 1);
            next.Hands[position][handSize] = card;
        }
Ejemplo n.º 2
0
        private StrategicState CreateNextState()
        {
            StrategicState next = new StrategicState(InPot.Length);

            for (int p = 0; p < InPot.Length; ++p)
            {
                next.InPot[p] = InPot[p];
                next.Hands[p] = Hands[p].ShallowCopy();
            }
            next.Pot           = Pot;
            next.ActivePlayers = ActivePlayers;
            return(next);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update by a strategy tree node. Cannot update active players.
        /// </summary>
        public StrategicState GetNextState(IStrategyTreeNode n)
        {
            StrategicState next = CreateNextState();

            if (!n.IsDealerAction)
            {
                UpdateAmount(next, n.Position, n.Amount);
            }
            else
            {
                UpdateHand(next, n.Position, n.Card);
            }
            return(next);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update by a strategic action.
        /// </summary>
        public StrategicState GetNextState(IStrategicAction action)
        {
            StrategicState next = CreateNextState();
            IPlayerAction  pa   = action as IPlayerAction;

            if (pa != null)
            {
                UpdateAmount(next, pa.Position, pa.Amount);
                IActionTreeNode an = pa as IActionTreeNode;
                if (an != null)
                {
                    next.ActivePlayers = an.ActivePlayers;
                }
            }
            else
            {
                IDealerAction da = action as IDealerAction;
                UpdateHand(next, da.Position, da.Card);
            }

            return(next);
        }
Ejemplo n.º 5
0
 private void UpdateAmount(StrategicState next, int position, double amount)
 {
     next.Pot             += amount;
     next.InPot[position] += amount;
 }