Exemplo n.º 1
0
        private StateNode BuildFoldNode(int playerNumber, int depthBet)
        {
            var children = BuildChildren(new List <string>(), NextPlayerNum(playerNumber), depthBet);
            var foldNode = new StateNode(StateNode.Fold, playerNumber, children);

            return(foldNode);
        }
Exemplo n.º 2
0
        private StateNode BuildRootNode(int playerNumber, int depthBet)
        {
            var namesChildren = new List <string> {
                StateNode.Bet, StateNode.Check
            };

            var children  = BuildChildren(namesChildren, playerNumber, depthBet);
            var checkNode = new StateNode(StateNode.Check, playerNumber, children);

            return(checkNode);
        }
Exemplo n.º 3
0
        public void PerfomAction(string nameAction)
        {
            var children = _currentNode.GetChildren();

            foreach (var child in children)
            {
                if (child.GetNameNode() == nameAction)
                {
                    _currentNode = child;
                }
            }
        }
Exemplo n.º 4
0
        private StateNode BuildCheckNode(int playerNumber, int depthBet)
        {
            List <string> namesChildren = new List <string>();

            if (playerNumber + 1 != StateNode.NumberPlayers)
            {
                namesChildren.Add(StateNode.Bet);
                namesChildren.Add(StateNode.Check);
            }
            var children  = BuildChildren(namesChildren, NextPlayerNum(playerNumber), depthBet);
            var checkNode = new StateNode(StateNode.Check, playerNumber, children);

            return(checkNode);
        }
Exemplo n.º 5
0
        private StateNode BuildBetNode(int playerNumber, int depthBet)
        {
            depthBet += 1;
            var namesChildren = new List <string> {
                StateNode.Call, StateNode.Fold
            };

            if (_maxDepth - depthBet > 0)
            {
                namesChildren.Add(StateNode.Bet);
            }
            var children = BuildChildren(namesChildren, NextPlayerNum(playerNumber), depthBet);
            var betNode  = new StateNode(StateNode.Bet, playerNumber, children);

            return(betNode);
        }
Exemplo n.º 6
0
 public void NewGame()
 {
     _currentNode = _root;
 }
Exemplo n.º 7
0
 public Tree(int maxDepth)
 {
     this._maxDepth = maxDepth;
     _root          = BuildTree();
     _currentNode   = _root;
 }