//this calc impl. will match the other players wager if its not too far from the value of our own hand public override PlayerAction calc(List <PlayerAction> actions, TurnDetails details) { //determine current values Fold fold = new Fold(); int estVal = estimateValueOfHand(details); int actionIndex = actions.Count - 1; int inValue = actions[actionIndex].Amount + details.betAmount; //if they aren't wagering more than 120% our est. monetary value, then call if (inValue <= (estVal + (estVal * .2f))) { details.betAmount += actions[actionIndex].Amount; return(new PlayerAction(details.name, details.phase, "call", 0)); } //otherwise fold, we're beat return(fold.calc(actions, details)); }
//This calc implementation only allows the player do fold instead of check in the second round. public override PlayerAction calc(List <PlayerAction> actions, TurnDetails details) { //Bet1 always returns a check from here if (details.phase == "Bet1") { return(new PlayerAction(details.name, details.phase, "check", 0)); } //Bet2 only cheks if it has a hand ranking higher then 1 if (details.rating >= 2) { return(new PlayerAction(details.name, details.phase, "check", 0)); } //Otherwise it folds Fold fold = new Fold(); return(fold.calc(actions, details)); }