public override PlayerAction GetTurn(GetTurnContext context) { int opponentMoney = (this.startGameMoney * 2) - context.MyMoneyInTheRound - context.MoneyLeft; var getActionContext = new GetActionContext( context.PreviousRoundActions, this.currentGameStackStage, this.roundsActions, context.RoundType, this.FirstCard, this.SecondCard, this.CommunityCards, context.SmallBlind, context.MoneyLeft, opponentMoney, context.CurrentPot, context.CanCheck, this.Name); PlayerAction action = null; if (action == null) { action = BaseStrategy.GetPlayerAction(getActionContext); } if (action.Type == PlayerActionType.Raise && action.Money == context.MoneyLeft) { this.lastMyPushMoney = context.MoneyLeft - context.MyMoneyInTheRound; } return(action); }
private static PlayerGameType RecognitionPlayerGameType(GetActionContext context) { var handStrength = HandEvaluator.Evaluate(context.FirstCard, context.SecondCard, context.CommunityCards); if (CheckFoldGameHands.Contains(handStrength)) { return(PlayerGameType.CheckFold); } if (BluffGameHands.Contains(handStrength)) { return(PlayerGameType.Bluff); } if (SmallValueGameHands.Contains(handStrength)) { return(PlayerGameType.SmallValue); } if (MaxValueGameHands.Contains(handStrength)) { return(PlayerGameType.MaxValue); } if (CheckCallSmallGameHands.Contains(handStrength)) { return(PlayerGameType.CheckCallSmall); } throw new System.ArgumentException("PlayerGameType Error !!"); }
public static PlayerAction GetPreflopAction(GetActionContext context) { PlayerAction action; if (context.PreviousRoundActions.Count == 2) { behaviourValue = GetBehaviourValue(context.FirstCard, context.SecondCard, SmallBlindMatrix); action = RecognitionFirstAction(context); return action; } if (context.PreviousRoundActions.Count == 3) { if (context.CanCheck) { behaviourValue = GetBehaviourValue(context.FirstCard, context.SecondCard, BigBlindMatrixWhenSmallBlindLimp); action = RecognitionFirstAction(context); return action; } else { behaviourValue = GetBehaviourValue(context.FirstCard, context.SecondCard, BigBlindMatrixWhenSmallBlindRaise); action = RecognitionFirstAction(context); return action; } } else { action = RecognitionSecondAction(context); return action; } }
public static PlayerAction GetTurnAction(GetActionContext context) { if (context.CurrentPot / 3 > context.MyMoney) { return(PlayerAction.Raise(context.MyMoney)); } var playerGameType = RecognitionPlayerGameType(context); return(GetFlopAction(context)); }
private static PlayerAction RecognitionFirstAction(GetActionContext context) { int bigBlind = context.SmallBlind * 2; var lastAction = context.PreviousRoundActions.LastOrDefault(); int lastActionMoney = lastAction.Action.Money; switch (behaviourValue) { case 0: return(PlayerAction.Fold()); case 1: return(PlayerAction.CheckOrCall()); case 2: return(PlayerAction.CheckOrCall()); case 3: return(PlayerAction.CheckOrCall()); case 4: return(PlayerAction.CheckOrCall()); case 5: return(PlayerAction.Raise(bigBlind)); case 6: return(PlayerAction.Raise(bigBlind)); case 7: return(PlayerAction.Raise(bigBlind)); case 8: return(PlayerAction.Raise(context.MyMoney)); case 9: if (lastActionMoney <= bigBlind) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 10: if (lastActionMoney <= bigBlind * 2) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 11: return(PlayerAction.Raise(lastActionMoney * 2)); case 12: return(PlayerAction.Raise(lastActionMoney * 2)); case 13: return(PlayerAction.CheckOrCall()); default: throw new System.ArgumentException(); } }
public static PlayerAction GetFlopAction(GetActionContext context) { if (context.CurrentPot / 2 > context.MyMoney) { return(PlayerAction.Raise(context.MyMoney)); } var handStrength = HandEvaluator.Evaluate(context.FirstCard, context.SecondCard, context.CommunityCards); if (CheckFoldHands.Any(h => h == handStrength)) { return(PlayerAction.Fold()); } return(PlayerAction.Raise(context.OpponentStack)); }
public static PlayerAction GetPreflopAction(GetActionContext context) { double value; var absDiffrent = System.Math.Abs(context.OpponentStack - context.MyMoney); var maxlossMoneyBB = (((InitialStack * 2) - absDiffrent) / 2) / (context.SmallBlind * 2); if (context.PreviousRoundActions.Count == 2) { value = GetCurrentHandPushStack(context.FirstCard, context.SecondCard, PushFoldMatrix); } else { value = GetCurrentHandPushStack(context.FirstCard, context.SecondCard, CallFoldMatrix); } if (value >= maxlossMoneyBB) { return(PlayerAction.Raise(context.MyMoney)); } else { return(PlayerAction.Fold()); } }
private static PlayerAction RecognitionSecondAction(GetActionContext context) { int bigBlind = context.SmallBlind * 2; var lastAction = context.PreviousRoundActions.LastOrDefault(); int lastActionMoney = lastAction.Action.Money; var lastMyAction = context.PreviousRoundActions.LastOrDefault(x => x.PlayerName == context.Name); int lastMyActionMoney = lastAction.Action.Money; switch (behaviourValue) { case 1: if (lastActionMoney < bigBlind) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 2: if (lastActionMoney <= bigBlind) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 3: if (lastActionMoney <= bigBlind * 2) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 4: return(PlayerAction.Raise(context.MyMoney)); case 5: if (lastActionMoney <= bigBlind) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 6: if (lastActionMoney <= lastMyActionMoney * 2) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case 7: return(PlayerAction.Raise(context.MyMoney)); case 11: return(PlayerAction.Fold()); case 12: return(PlayerAction.Raise(context.MyMoney)); default: return(PlayerAction.CheckOrCall()); } }
public static PlayerAction GetFlopAction(GetActionContext context) { if (context.CurrentPot / 3 > context.MyMoney) { return(PlayerAction.Raise(context.MyMoney)); } var playerGameType = RecognitionPlayerGameType(context); switch (playerGameType) { case PlayerGameType.CheckFold: if (context.CanCheck || context.MyMoney == 0) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } case PlayerGameType.CheckCallSmall: if (context.CanCheck || context.MyMoney == 0) { return(PlayerAction.CheckOrCall()); } else { if (context.PreviousRoundActions.LastOrDefault().Action.Money <= context.CurrentPot / 2 || context.MyMoney == 0) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } } case PlayerGameType.SmallValue: if (context.CanCheck) { return(PlayerAction.Raise(context.CurrentPot / 3)); } else { var lastMyAction = context.PreviousRoundActions.LastOrDefault(x => x.PlayerName == context.Name); if (lastMyAction.Action != null && lastMyAction.Action.Type == PlayerActionType.Raise && context.PreviousRoundActions.LastOrDefault().Action.Money >= lastMyAction.Action.Money) { return(PlayerAction.Fold()); } if (context.PreviousRoundActions.LastOrDefault().Action.Money <= context.CurrentPot / 2 || context.MyMoney == 0) { return(PlayerAction.CheckOrCall()); } else { return(PlayerAction.Fold()); } } case PlayerGameType.MaxValue: return(PlayerAction.Raise(context.CurrentPot / 3)); case PlayerGameType.Bluff: throw new System.NotImplementedException("Bluff"); default: throw new System.ArgumentException("PlayerGameType Error !!"); } }