private PlayerAction GetActionByCardValuationType(CardValuationType playHand, GetTurnContext context) { if (playHand == CardValuationType.Unplayable) { return this.GetUnplayableAction(context); } if (playHand == CardValuationType.Risky) { return this.ChooseAction(context.MoneyLeft, 0.1f); } if (playHand == CardValuationType.Recommended) { return this.ChooseAction(context.MoneyLeft, 0.25f); } if (playHand == CardValuationType.VeryPowerful) { return this.ChooseAction(context.MoneyLeft, 0.5f); } if (playHand == CardValuationType.AllIn) { return this.ChooseAction(context.MoneyLeft, 1f); } return PlayerAction.CheckOrCall(); }
private PlayerAction GetActionByCardValuationType(CardValuationType playHand, GetTurnContext context) { if (playHand == CardValuationType.Unplayable) { return GetUnplayableAction(context); } if (playHand == CardValuationType.Recommended && context.CanCheck) { return ChooseAction(context.MoneyLeft, 0.1f); } if (playHand == CardValuationType.VeryRecommended) { return ChooseAction(context.MoneyLeft, 0.1f); } if (playHand == CardValuationType.GoodHand) { return ChooseAction(context.MoneyLeft, 0.2f); } if (playHand == CardValuationType.VeryGoodHand) { return ChooseAction(context.MoneyLeft, 0.25f); } if (playHand == CardValuationType.PowerfulHand) { return ChooseAction(context.MoneyLeft, 0.4f); } if (playHand == CardValuationType.VeryPowerfulHand) { return ChooseAction(context.MoneyLeft, 0.5f); } if (playHand == CardValuationType.AllIn) { return ChooseAction(context.MoneyLeft, 1f); } return PlayerAction.CheckOrCall(); }
public override void StartHand(StartHandContext context) { // this.ourMoney = context.MoneyLeft; this.smallBlind = context.SmallBlind; this.ourSmallBlindsLeft = this.ourMoney / this.smallBlind; this.firstCard = context.FirstCard; this.secondCard = context.SecondCard; this.opponentType = stats.OpponentType(); this.ourMoney = (int)context.MoneyLeft; stats.oppHandsCount++; if (ourSmallBlindsLeft >= 50) { if (stats.EnougthInfo()) { if (opponentType == OpponentEvaluationType.Solid) { this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstSolidOpponent(this.firstCard, this.secondCard); } else if (opponentType == OpponentEvaluationType.Tight) { this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstTightOpponent(this.firstCard, this.secondCard); } else if (opponentType == OpponentEvaluationType.Wild) { this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstWildOpponent(this.firstCard, this.secondCard); } else if (opponentType == OpponentEvaluationType.Tornado) { this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstTornado(this.firstCard, this.secondCard); } } else { this.cardPreflopStrength = HandStrengthValuation.PreFlop(this.firstCard, this.secondCard); } } }
private PlayerAction PreflopLogic(GetTurnContext context) { this.ownCardsStrength = PreflopHandStrengthValuation.GetRecommendation(this.FirstCard, this.SecondCard); if (context.SmallBlind == 1) { if (!this.isAlwaysAllIn && context.CurrentPot + context.MoneyLeft == 2000) { this.allInCount++; if (this.allInCount > MagicNumber) { this.isAlwaysAllIn = true; } if (this.ownCardsStrength < CardValuationType.Strong) { return(PlayerAction.Fold()); } } } // handling AlwaysAllIn Player if (this.isAlwaysAllIn && context.CurrentPot + context.MoneyLeft == 2000) { if (context.SmallBlind <= 3) { if (this.ownCardsStrength > CardValuationType.Recommended) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Fold()); } if (this.ownCardsStrength >= CardValuationType.Recommended || this.FirstCard.Type >= CardType.King || this.SecondCard.Type >= CardType.King) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Fold()); } if (context.MoneyLeft <= context.SmallBlind * 10 /*&& ownCardsStrength > CardValuationType.Unplayable*/) { return(PlayerAction.Raise(context.MoneyLeft)); } if (context.PreviousRoundActions.Count == 2) { if (this.ownCardsStrength == CardValuationType.Unplayable) { return(PlayerAction.Fold()); } if (this.ownCardsStrength == CardValuationType.Monster) { if (isCallingStation) { return(PlayerAction.Raise((context.CurrentPot * 7) - MagicNumber)); } if (isVeryAggressive) { return(PlayerAction.Raise((context.CurrentPot * 2) + MagicNumber)); } return(PlayerAction.Raise((context.CurrentPot * 10) - MagicNumber)); } if (this.ownCardsStrength >= CardValuationType.Recommended) { if (isCallingStation) { return(PlayerAction.Raise((10 * context.SmallBlind) - MagicNumber)); } return(PlayerAction.Raise((6 * context.SmallBlind) - MagicNumber)); } if (this.ownCardsStrength == CardValuationType.Risky) { if (isCallingStation || this.isAlwaysRaise) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Raise((5 * context.SmallBlind) - MagicNumber)); } if (this.ownCardsStrength == CardValuationType.NotRecommended) { if (isCallingStation) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Raise((4 * context.SmallBlind) + MagicNumber)); } } // Facing a raise if (isSmallBlind && context.PreviousRoundActions.Count > 2) { if (this.ownCardsStrength == CardValuationType.NotRecommended) { return(PlayerAction.Fold()); } if (this.ownCardsStrength == CardValuationType.Monster) { return(PlayerAction.Raise(Math.Min(((2 * context.MoneyToCall) + MagicNumber) + context.CurrentPot, AllIn(context.MoneyLeft)))); } if (context.MoneyLeft <= context.SmallBlind * 20) { if (this.FirstCard.Type == CardType.Ace || this.SecondCard.Type == CardType.Ace || this.ownCardsStrength >= CardValuationType.Recommended) { return(PlayerAction.Raise(AllIn(context.MoneyLeft))); } return(PlayerAction.Fold()); } if (this.ownCardsStrength >= CardValuationType.Recommended) { if (context.MoneyToCall <= context.MoneyLeft / 8) { return(PlayerAction.CheckOrCall()); } if (this.ownCardsStrength == CardValuationType.Strong && context.MoneyToCall <= context.MoneyLeft / 5) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Fold()); } if (isSmallBlind && context.MoneyToCall <= context.MoneyLeft * 0.2) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Fold()); } // Big blind if (!isSmallBlind && context.PreviousRoundActions.Count >= 3) { if (this.lastAction == PlayerActionType.Raise) { if (this.ownCardsStrength <= CardValuationType.NotRecommended) { if (this.isAlwaysRaise) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Fold()); } } if (this.ownCardsStrength == CardValuationType.Risky) { if (context.MoneyToCall > context.MoneyLeft * 0.2) { return(PlayerAction.Fold()); } return(PlayerAction.CheckOrCall()); } if (this.lastAction == PlayerActionType.CheckCall) { if (this.ownCardsStrength == CardValuationType.Monster) { return(PlayerAction.Raise((context.CurrentPot * 5) - MagicNumber)); } if (this.ownCardsStrength >= CardValuationType.Recommended) { return(PlayerAction.Raise((8 * context.SmallBlind) - MagicNumber)); } if (this.ownCardsStrength == CardValuationType.Risky) { return(PlayerAction.Raise((2 * context.SmallBlind) + MagicNumber)); } if (this.ownCardsStrength == CardValuationType.NotRecommended) { return(PlayerAction.CheckOrCall()); } } if (this.lastAction == PlayerActionType.Raise && this.ownCardsStrength > CardValuationType.NotRecommended) { if (this.ownCardsStrength > CardValuationType.Recommended) { return(PlayerAction.Raise(Math.Min(context.CurrentPot + (2 * context.MoneyToCall), context.MoneyLeft))); } if (this.ownCardsStrength == CardValuationType.Recommended) { if (context.MoneyToCall < context.MoneyLeft && context.MoneyToCall < context.SmallBlind * 8) { return(PlayerAction.CheckOrCall()); } return(PlayerAction.Fold()); } if (this.ownCardsStrength == CardValuationType.Risky) { if (context.MoneyToCall > context.MoneyLeft * 0.1 && context.MoneyToCall > context.SmallBlind * 5) { return(PlayerAction.Fold()); } return(PlayerAction.CheckOrCall()); } } } return(PlayerAction.CheckOrCall()); }
public HandsHolder(CardValuationType playHand, HandRankType bestHand, HandRankType bestHandOnTable) { this.PlayHand = playHand; this.BestHand = bestHand; this.BestHandOnTable = bestHandOnTable; }
private PlayerAction PreflopLogic(GetTurnContext context) { this.ownCardsStrength = PreflopHandStrengthValuation.GetRecommendation(this.FirstCard, this.SecondCard); if (context.SmallBlind == 1) { if (!this.isAlwaysAllIn && context.CurrentPot + context.MoneyLeft == 2000) { this.allInCount++; if (this.allInCount > MagicNumber) { this.isAlwaysAllIn = true; } if (this.ownCardsStrength < CardValuationType.Strong) { return PlayerAction.Fold(); } } } // handling AlwaysAllIn Player if (this.isAlwaysAllIn && context.CurrentPot + context.MoneyLeft == 2000) { if (context.SmallBlind <= 3) { if (this.ownCardsStrength > CardValuationType.Recommended) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } if (this.ownCardsStrength >= CardValuationType.Recommended || this.FirstCard.Type >= CardType.King || this.SecondCard.Type >= CardType.King) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } if (context.MoneyLeft <= context.SmallBlind * 10 /*&& ownCardsStrength > CardValuationType.Unplayable*/) { return PlayerAction.Raise(context.MoneyLeft); } if (context.PreviousRoundActions.Count == 2) { if (this.ownCardsStrength == CardValuationType.Unplayable) { return PlayerAction.Fold(); } if (this.ownCardsStrength == CardValuationType.Monster) { if (isCallingStation) { return PlayerAction.Raise((context.CurrentPot * 7) - MagicNumber); } if (isVeryAggressive) { return PlayerAction.Raise((context.CurrentPot * 2) + MagicNumber); } return PlayerAction.Raise((context.CurrentPot * 10) - MagicNumber); } if (this.ownCardsStrength >= CardValuationType.Recommended) { if (isCallingStation) { return PlayerAction.Raise((10 * context.SmallBlind) - MagicNumber); } return PlayerAction.Raise((6 * context.SmallBlind) - MagicNumber); } if (this.ownCardsStrength == CardValuationType.Risky) { if (isCallingStation || this.isAlwaysRaise) { return PlayerAction.CheckOrCall(); } return PlayerAction.Raise((5 * context.SmallBlind) - MagicNumber); } if (this.ownCardsStrength == CardValuationType.NotRecommended) { if (isCallingStation) { return PlayerAction.CheckOrCall(); } return PlayerAction.Raise((4 * context.SmallBlind) + MagicNumber); } } // Facing a raise if (isSmallBlind && context.PreviousRoundActions.Count > 2) { if (this.ownCardsStrength == CardValuationType.NotRecommended) { return PlayerAction.Fold(); } if (this.ownCardsStrength == CardValuationType.Monster) { return PlayerAction.Raise(Math.Min(((2 * context.MoneyToCall) + MagicNumber) + context.CurrentPot, AllIn(context.MoneyLeft))); } if (context.MoneyLeft <= context.SmallBlind * 20) { if (this.FirstCard.Type == CardType.Ace || this.SecondCard.Type == CardType.Ace || this.ownCardsStrength >= CardValuationType.Recommended) { return PlayerAction.Raise(AllIn(context.MoneyLeft)); } return PlayerAction.Fold(); } if (this.ownCardsStrength >= CardValuationType.Recommended) { if (context.MoneyToCall <= context.MoneyLeft / 8) { return PlayerAction.CheckOrCall(); } if (this.ownCardsStrength == CardValuationType.Strong && context.MoneyToCall <= context.MoneyLeft / 5) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } if (isSmallBlind && context.MoneyToCall <= context.MoneyLeft * 0.2) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } // Big blind if (!isSmallBlind && context.PreviousRoundActions.Count >= 3) { if (this.lastAction == PlayerActionType.Raise) { if (this.ownCardsStrength <= CardValuationType.NotRecommended) { if (this.isAlwaysRaise) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } } if (this.ownCardsStrength == CardValuationType.Risky) { if (context.MoneyToCall > context.MoneyLeft * 0.2) { return PlayerAction.Fold(); } return PlayerAction.CheckOrCall(); } if (this.lastAction == PlayerActionType.CheckCall) { if (this.ownCardsStrength == CardValuationType.Monster) { return PlayerAction.Raise((context.CurrentPot * 5) - MagicNumber); } if (this.ownCardsStrength >= CardValuationType.Recommended) { return PlayerAction.Raise((8 * context.SmallBlind) - MagicNumber); } if (this.ownCardsStrength == CardValuationType.Risky) { return PlayerAction.Raise((2 * context.SmallBlind) + MagicNumber); } if (this.ownCardsStrength == CardValuationType.NotRecommended) { return PlayerAction.CheckOrCall(); } } if (this.lastAction == PlayerActionType.Raise && this.ownCardsStrength > CardValuationType.NotRecommended) { if (this.ownCardsStrength > CardValuationType.Recommended) { return PlayerAction.Raise(Math.Min(context.CurrentPot + (2 * context.MoneyToCall), context.MoneyLeft)); } if (this.ownCardsStrength == CardValuationType.Recommended) { if (context.MoneyToCall < context.MoneyLeft && context.MoneyToCall < context.SmallBlind * 8) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } if (this.ownCardsStrength == CardValuationType.Risky) { if (context.MoneyToCall > context.MoneyLeft * 0.1 && context.MoneyToCall > context.SmallBlind * 5) { return PlayerAction.Fold(); } return PlayerAction.CheckOrCall(); } } } return PlayerAction.CheckOrCall(); }
public override PlayerAction GetTurn(GetTurnContext context) { //context.CanCheck; //context.CurrentMaxBet; //context.CurrentPot; //context.IsAllIn; //context.MoneyToCall; //context.MyMoneyInTheRound; #region evaluating hand if (50 > ourSmallBlindsLeft && ourSmallBlindsLeft >= 17) { if (context.PreviousRoundActions.Count == 2) { // we are on btn this.cardPreflopStrength = TwentyFiveBlindsHandStrengthValuation.PreFlopOnButton(this.firstCard, this.secondCard); } else if (context.PreviousRoundActions.Count == 3) { this.cardPreflopStrength = TwentyFiveBlindsHandStrengthValuation.PreFlopOnBigBlind(this.firstCard, this.secondCard); //we are on big blind } } else if (ourSmallBlindsLeft < 17) { if (context.PreviousRoundActions.Count == 2) { // we are on btn this.cardPreflopStrength = TenBigBlindsHandStrengthValuation.PreflopShove(this.firstCard, this.secondCard); } else if (context.PreviousRoundActions.Count == 3) { this.cardPreflopStrength = TenBigBlindsHandStrengthValuation.PreflopCallAllIn(this.firstCard, this.secondCard); //we are on big blind } } #endregion if (context.RoundType == GameRoundType.PreFlop) { var amountOfMoneyToRaisePreflop = 1; #region how much to raise preflop if (this.smallBlind > 100) { //TODO change value amountOfMoneyToRaisePreflop = this.smallBlind * 10; } else if (this.smallBlind > 17) { //TODO change value amountOfMoneyToRaisePreflop = this.smallBlind * 5; } else if (this.smallBlind <= 17) { amountOfMoneyToRaisePreflop = ourMoney; } #endregion #region preflopaction if (context.PreviousRoundActions.Count == 2)//we are on button { if (stats.EnougthInfo()) { if (this.opponentType == OpponentEvaluationType.Tornado) { if (this.cardPreflopStrength == CardValuationType.CallTornadoAllIn) { return PlayerAction.Raise(amountOfMoneyToRaisePreflop); } } } else { if ( cardPreflopStrength == CardValuationType.Raise || this.cardPreflopStrength == CardValuationType.ThreeBet || this.cardPreflopStrength == CardValuationType.AllIn) { return PlayerAction.Raise(amountOfMoneyToRaisePreflop); } return PlayerAction.Fold(); } } else if (context.PreviousRoundActions.Count == 3) { stats.OppPreflopRaise(); if (this.opponentType == OpponentEvaluationType.Tornado) { if (this.cardPreflopStrength == CardValuationType.CallTornadoAllIn) { if (context.IsAllIn || context.MoneyToCall > ourMoney / 20) { return PlayerAction.Raise(ourMoney * 2); } else { return PlayerAction.Raise(amountOfMoneyToRaisePreflop); } } if (context.CanCheck) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } else { if ( this.cardPreflopStrength == CardValuationType.Raise || this.cardPreflopStrength == CardValuationType.ThreeBet || this.cardPreflopStrength == CardValuationType.AllIn) { if (context.IsAllIn || context.MoneyToCall > ourMoney / 20) { return PlayerAction.Raise(ourMoney * 2); } else { return PlayerAction.Raise(amountOfMoneyToRaisePreflop); } } if (context.CanCheck) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } } else if (context.PreviousRoundActions.Count == 4)//sb and opp has 3betet us { stats.OppPreflopRaise(); if (this.opponentType == OpponentEvaluationType.Tornado) { if (this.cardPreflopStrength == CardValuationType.CallTornadoAllIn) { if (context.MoneyToCall * 3 > ourMoney / 10) { return PlayerAction.Raise(ourMoney * 2); } return PlayerAction.Raise(context.MoneyToCall * 3); } } else { if ( this.cardPreflopStrength == CardValuationType.AllIn) { if (context.MoneyToCall * 3 > ourMoney / 10) { return PlayerAction.Raise(ourMoney * 2); } return PlayerAction.Raise(context.MoneyToCall * 3); } return PlayerAction.Fold(); } } else if (context.PreviousRoundActions.Count == 5 || context.PreviousRoundActions.Count == 6) //opponent has 4-betet us { stats.OppPreflopRaise(); if (this.opponentType == OpponentEvaluationType.Tornado) { if (this.cardPreflopStrength == CardValuationType.CallTornadoAllIn) { if (context.MoneyToCall * 3 > ourMoney / 10) { return PlayerAction.Raise(ourMoney * 2); } return PlayerAction.Raise(context.MoneyToCall * 3); } } else { if (this.cardPreflopStrength == CardValuationType.AllIn) { return PlayerAction.Raise(ourMoney * 2); } return PlayerAction.Fold(); } } } #endregion else if (context.RoundType == GameRoundType.Flop) { var moneyToRaise = 1; stats.OpponentPlaysOnFlop(); #region amount of money to raise //amount of money to raise onf lop if (context.MoneyLeft / 5 > context.CurrentPot) { if (context.MoneyToCall <= context.SmallBlind * 2) { moneyToRaise = context.CurrentPot / 3; } else { if (context.MoneyLeft / 8 > context.MoneyToCall * 3) { moneyToRaise = context.MoneyLeft / 8; } else { moneyToRaise = ourMoney * 2; } } } else { moneyToRaise = ourMoney * 2; } if (moneyToRaise < ourMoney / 50) { moneyToRaise = ourMoney / 45; } #endregion if (context.CanCheck || context.MoneyToCall <= ourMoney / 30) { if ((int)ourCompleteHand >= 1)//enougth value, value bet { return PlayerAction.Raise(moneyToRaise); } else if (!stats.EnougthInfo()) { return PlayerAction.Raise(moneyToRaise); } else if (stats.EnougthInfo() && (stats.GetOpponentCallCBetStats() < 0.3)) { return PlayerAction.Raise(moneyToRaise); } } else//enought value to { if ((int)ourCompleteHand > 1) { return PlayerAction.Raise(moneyToRaise); } } return PlayerAction.Fold(); } else if (context.RoundType == GameRoundType.Turn) { var moneyToRaise = 1; if (context.MoneyLeft / 5 > context.CurrentPot) { if (context.MoneyToCall <= context.SmallBlind * 2) { moneyToRaise = context.CurrentPot / 3; } else { if (context.MoneyLeft / 8 > context.MoneyToCall * 3) { moneyToRaise = context.MoneyLeft / 8; } else { moneyToRaise = ourMoney * 2; } } } else { moneyToRaise = ourMoney * 2; } if (moneyToRaise < ourMoney / 40) { moneyToRaise = ourMoney / 35; } if (context.CanCheck || context.MoneyToCall <= ourMoney / 40) { if ((int)ourCompleteHand >= 1)//enougth value, value bet { return PlayerAction.Raise(moneyToRaise); } } else { if ((int)ourCompleteHand >= 2)//enougth value, value bet { return PlayerAction.Raise(moneyToRaise); } } return PlayerAction.Fold(); } else { stats.OpponentCallsCBet(); var moneyToRaise = 1; if (moneyToRaise < ourMoney / 30) { moneyToRaise = ourMoney / 26; } if (context.MoneyLeft / 5 > context.CurrentPot) { if (context.MoneyToCall <= context.SmallBlind * 2) { moneyToRaise = context.CurrentPot / 3; } else { if (context.MoneyLeft / 8 > context.MoneyToCall * 3) { moneyToRaise = context.MoneyLeft / 8; } else { moneyToRaise = ourMoney * 2; } } } else { moneyToRaise = ourMoney * 2; } if (context.CanCheck || context.MoneyToCall <= ourMoney / 40) { if ((int)ourCompleteHand <= 2)//enougth value, value bet { return PlayerAction.CheckOrCall(); } else { return PlayerAction.Raise(moneyToRaise); } } else { if ((int)ourCompleteHand <= 2)//enougth value, value bet { return PlayerAction.CheckOrCall(); } else { return PlayerAction.Raise(moneyToRaise); } } } return PlayerAction.Fold(); }