Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #3
0
        public void PerfomAction(string nameAction)
        {
            var children = _currentNode.GetChildren();

            foreach (var child in children)
            {
                if (child.GetNameNode() == nameAction)
                {
                    _currentNode = child;
                }
            }
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #6
0
 public void NewGame()
 {
     _currentNode = _root;
 }
Beispiel #7
0
 public Tree(int maxDepth)
 {
     this._maxDepth = maxDepth;
     _root          = BuildTree();
     _currentNode   = _root;
 }