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