private PlayerAction DesideByHand(byte bestHand, GetTurnContext context) { // don't play if chance is less than 50% if (bestHand <= 2) { if (context.CanCheck) { return PlayerAction.CheckOrCall(); } else { return PlayerAction.Fold(); } } else if (bestHand < 4) { var smallBlindsTimes = RandomProvider.Next(5, 20); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } else if (bestHand < 5) { var smallBlindsTimes = RandomProvider.Next(15, 30); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } else { var smallBlindsTimes = RandomProvider.Next(25, 100); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.MoneyLeft <= 250) { // CLOSE to LOOSING The Game - PLay aggresivly to return back the stack var preFlopCards = CustomHandEvaluator.PreFlopAggressive(context, this.FirstCard, this.SecondCard); var firstCard = this.FirstCard; var secondCard = this.SecondCard; var communityCards = this.CommunityCards; return CustomStackActions.NormalStackMethod(context, preFlopCards, firstCard, secondCard, communityCards); } else if (context.MoneyLeft > 250 && context.MoneyLeft < 1750) { var preFlopCards = CustomHandEvaluator.PreFlop(context, this.FirstCard, this.SecondCard); var firstCard = this.FirstCard; var secondCard = this.SecondCard; var communityCards = this.CommunityCards; return CustomStackActions.NormalStackMethod(context, preFlopCards, firstCard, secondCard, communityCards); } else { // context.MoneyLeft > 1600 we are CHIPLEADERS - FIGHT With AGRESSION! var preFlopCards = CustomHandEvaluator.PreFlopAggressive(context, this.FirstCard, this.SecondCard); var firstCard = this.FirstCard; var secondCard = this.SecondCard; var communityCards = this.CommunityCards; return CustomStackActions.NormalStackMethod(context, preFlopCards, firstCard, secondCard, communityCards); } }
public static PlayerAction GetPlayerAction(float odds, int enemyMoney, GetTurnContext context) { var merit = odds * context.CurrentPot / context.MoneyToCall; if (odds > .63) { return PlayerAction.Raise(context.MoneyLeft + 1); } if (odds >= .6 && enemyMoney + context.MoneyToCall < context.MoneyLeft) { return PlayerAction.Raise(context.MoneyLeft + 1); } if (odds >= .5 && enemyMoney + context.MoneyToCall < context.MoneyLeft / 4) { return PlayerAction.Raise(context.MoneyLeft + 1); } // PlayerAction.Raise(context.MoneyLeft + 1); if (merit > 6) //moneytocall { return PlayerAction.CheckOrCall(); } // fcsk it if (context.CanCheck) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.RoundType == GameRoundType.PreFlop) { //TODO: Implement raise when on position //TODO: Implement raise with medium hand not on position //TODO: Implement check/call with trash //TODO: Implement All-in when short stack under 10 BB //TODO: Implement All-in with medium hand when opponent raise } else if (context.RoundType == GameRoundType.Flop) { //TODO: Implement value bet //TODO: Implement c-bet //TODO: Implement min prob bet //TODO: Implement slow play with monster hand //TODO: Implement Raise with best hand } else if (context.RoundType == GameRoundType.Turn) { } else { } return new object() as PlayerAction; // Just to Build }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.RoundType == GameRoundType.PreFlop) { var playHand = HandStrengthValuation.PreFlop(this.FirstCard, this.SecondCard); if (playHand == CardValuationType.Unplayable) { return GetUnplayableAction(context); } if (playHand == CardValuationType.Risky) { var smallBlindsTimes = RandomProvider.Next(1, 8); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } if (playHand == CardValuationType.Recommended) { var smallBlindsTimes = RandomProvider.Next(6, 14); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } return PlayerAction.CheckOrCall(); } var strengthOfHand = CustomHandEvaluator.GetStrengthOfHand(this.FirstCard, this.SecondCard, this.CommunityCards); return GetActionByCardValuationType(strengthOfHand, context); }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.MoneyLeft <= 0) { return PlayerAction.CheckOrCall(); } if (context.RoundType == GameRoundType.PreFlop) { return this.GetActionForPreFlop(context); } else if (context.RoundType == GameRoundType.Flop) { return this.GetActionForFlop(context); } else if (context.RoundType == GameRoundType.Turn) { return this.GetActionForTurn(context); } else if (context.RoundType == GameRoundType.River) { return this.GetActionForRiver(context); } return PlayerAction.CheckOrCall(); }
public override PlayerAction GetTurn(GetTurnContext context) { this.DrawPlayerOptions(context.MoneyToCall); while (true) { var key = Console.ReadKey(true); PlayerAction action = null; switch (key.Key) { case ConsoleKey.C: action = PlayerAction.CheckOrCall(); break; case ConsoleKey.R: // ConsoleHelper.WriteOnConsole(this.row + 2, 2, $"Raise amount [1-{context.MoneyLeft}]: "); // continue; action = PlayerAction.Raise(10); break; case ConsoleKey.F: action = PlayerAction.Fold(); break; case ConsoleKey.A: action = context.MoneyLeft > 0 ? PlayerAction.Raise(context.MoneyLeft) : PlayerAction.CheckOrCall(); break; } if (action != null) { return action; } } }
public override PlayerAction GetTurn(GetTurnContext context) { var chanceForAction = RandomProvider.Next(1, 101); if (chanceForAction == 1 && context.MoneyLeft > 0) { // All-in return PlayerAction.Raise(context.MoneyLeft); } if (chanceForAction <= 15) { // Minimum raise return PlayerAction.Raise(1); } // Play safe if (context.CanCheck) { return PlayerAction.CheckOrCall(); } if (chanceForAction <= 60) { // Call return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); }
public override PlayerAction GetTurn(GetTurnContext context) { this.UpdateCommonRow(context.CurrentPot); ConsoleHelper.WriteOnConsole(this.row + 1, 2, context.MoneyLeft + " "); // HEREEEEEEEEEEeeee //System.Threading.Thread.Sleep(1000); var action = base.GetTurn(context); ConsoleHelper.WriteOnConsole(this.row + 2, 2, new string(' ', this.width - 3)); var lastAction = action.Type + (action.Type == PlayerActionType.Fold ? string.Empty : "(" + (action.Money + ((context.MoneyToCall < 0) ? 0 : context.MoneyToCall) + ")")); ConsoleHelper.WriteOnConsole(this.row + 3, 2, "Last action: " + lastAction + " "); var moneyAfterAction = action.Type == PlayerActionType.Fold ? context.MoneyLeft : context.MoneyLeft - action.Money - context.MoneyToCall; ConsoleHelper.WriteOnConsole(this.row + 1, 2, moneyAfterAction + " "); return action; }
public override PlayerAction GetTurn(GetTurnContext context) { this.UpdateCommonRow(context.CurrentPot); ConsoleHelper.WriteOnConsole(this.row + 2, 2, "Select action [C]heck/[C]all, [R]aise, [F]old, [A]ll-in"); while (true) { var key = Console.ReadKey(true); PlayerAction action = null; switch (key.Key) { case ConsoleKey.C: action = PlayerAction.CheckOrCall(); break; case ConsoleKey.R: // TODO: Ask for the raise amount! action = PlayerAction.Raise(10); break; case ConsoleKey.F: action = PlayerAction.Fold(); break; case ConsoleKey.A: action = PlayerAction.Raise(context.MoneyLeft); break; } // TODO: Check if the action is valid if (action != null) { ConsoleHelper.WriteOnConsole(this.row + 2, 2, new string(' ', this.width - 3)); ConsoleHelper.WriteOnConsole(this.row + 3, 2, action + " "); return action; } } }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.RoundType == GameRoundType.PreFlop) { var playHand = HandStrengthValuation.PreFlop(this.FirstCard, this.SecondCard); if (playHand == CardValuationType.Unplayable) { // ako drugiq e purvi i raisne to tuka ne moje da se vlezne. can check = false if (context.CanCheck) { return PlayerAction.CheckOrCall(); } else { return PlayerAction.Fold(); } } if (playHand == CardValuationType.Risky) { var smallBlindsTimes = RandomProvider.Next(1, 8); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } if (playHand == CardValuationType.Recommended) { var smallBlindsTimes = RandomProvider.Next(6, 14); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } return PlayerAction.CheckOrCall(); } return PlayerAction.CheckOrCall(); }
public override PlayerAction GetTurn(GetTurnContext context) { try { PlayerAction playerAction = null; ExecuteWithTimeLimit(TimeSpan.FromMilliseconds(50), () => playerAction = base.GetTurn(context)); if (playerAction != null) { return playerAction; } else { this.TimeOuts++; return PlayerAction.CheckOrCall(); } } catch (Exception ex) { this.Crashes++; if (this.FirstCrash == null) { this.FirstCrash = ex.ToString(); } return PlayerAction.CheckOrCall(); } }
public override PlayerAction GetTurn(GetTurnContext context) { var raise = context.MoneyLeft; if (this.HandStrength > .95 && raise > 0) { return PlayerAction.Raise(raise); } return PlayerAction.CheckOrCall(); }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.MoneyLeft > 0) { return PlayerAction.Raise(context.MoneyLeft); } else { return PlayerAction.CheckOrCall(); } }
/// <summary> /// Base GetTurn method. It contains AI's logic and returns a PlayerAction. /// </summary> /// <param name="context">Get Turn Context parameter.</param> /// <returns>Player action.</returns> public override PlayerAction GetTurn(GetTurnContext context) { var playHand = HandStrengthValuation.PreFlop(this.FirstCard, this.SecondCard); var bestHand = HandStrengthValuation.GetBestHand(this.CommunityCards, this.FirstCard, this.SecondCard); var bestHandOnTable = TableStrengthOpportunities.GetBestPossibleHand(this.CommunityCards, this.FirstCard, this.SecondCard); var handsHolder = new HandsHolder(playHand, bestHand, bestHandOnTable); var playerAction = PlayerActionFactory.GetPlayerAction(context, handsHolder); return playerAction; }
public override PlayerAction GetTurn(GetTurnContext context) { var bigBlind = context.SmallBlind * 2; var blindRatio = bigBlind / this.initialMoney; var moneyLeft = context.MoneyLeft; if (this.HandStrength < HandStrengthMargin && blindRatio < BlindRatioMargin && moneyLeft != 0) { return PlayerAction.Fold(); } return PlayerAction.CheckOrCall(); }
public override PlayerAction GetTurn(GetTurnContext context) { var playHand = HandStrengthValuation.PreFlop(this.FirstCard, this.SecondCard); if (playHand == CardValuationType.Recommended) { if (!context.IsAllIn) { return PlayerAction.Raise(context.MoneyLeft); } else { return PlayerAction.CheckOrCall(); } } return PlayerAction.Fold(); }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.MoneyLeft / this.BigBlind <= 5) { return PlayerAction.Raise(AllIn); } var decisionMaker = this.factory.GetDecisionMaker(context.RoundType); var decisionContext = new DecisionContext { CommunityCards = this.CommunityCards, FirstCard = this.FirstCard, SecondCard = this.SecondCard, TurnContext = context }; return decisionMaker.GetAction(decisionContext, this); }
internal void ProcessCurrentRound(GetTurnContext context, Card firstCard, Card secondCard, IReadOnlyCollection<Card> communityCards) { float[] probabilityOfAllHands = new float[9]; if (context.RoundType == GameRoundType.PreFlop) { var firstHandProbability = initialHandStrength.EvaluateHand(firstCard, secondCard); this.Action = decisionMaker.DesideByChance(firstHandProbability, context); } else { this.handIndex = bestHandStrenght.Evaluate(firstCard, secondCard, communityCards); probabilityOfAllHands = probabilityEvaluator.Evaluate(firstCard, secondCard, communityCards, context.RoundType); this.Action = decisionMaker.Deside(probabilityOfAllHands, context, handIndex); } }
public PlayerAction MakeTurn(GetTurnContext context, Card firstCard, Card secondCard, IReadOnlyCollection<Card> communityCards) { if (context.RoundType == GameRoundType.PreFlop) { PlayerAction act = PreFlopAction(context, firstCard, secondCard); return act; } if (context.RoundType == GameRoundType.Flop || context.RoundType == GameRoundType.River || context.RoundType == GameRoundType.Turn) { PlayerAction act = FlopAction(context, firstCard, secondCard, communityCards); return act; } 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 PlayerAction GetTurn(GetTurnContext context) { if (context.RoundType == GameRoundType.PreFlop) { ownCardsStrength = CardEvaluator.CalculateStrength(this.FirstCard, this.SecondCard); if (ownCardsStrength >= 9) { return PlayerAction.Raise((int)ownCardsStrength * context.SmallBlind); } if (ownCardsStrength >= 8) { return PlayerAction.CheckOrCall(); } return PlayerAction.Fold(); } if (context.RoundType == GameRoundType.Flop) { var cardsToevaluate = new List<Card>(); foreach (var cc in this.CommunityCards) { cardsToevaluate.Add(cc); } cardsToevaluate.Add(this.FirstCard); cardsToevaluate.Add(this.SecondCard); var bestCard = evaluator.GetBestHand(cardsToevaluate); if (bestCard.RankType == 0) { return PlayerAction.Fold(); } else { return PlayerAction.CheckOrCall(); } } return PlayerAction.CheckOrCall(); }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.RoundType == GameRoundType.PreFlop) { var playHand = HandStrengthValuation.PreFlop(this.FirstCard, this.SecondCard); if (playHand == CardValuationType.Unplayable) { return PlayerAction.Fold(); } else if (playHand == CardValuationType.Recommended) { return PlayerAction.Raise(context.SmallBlind * 2); } else { return PlayerAction.CheckOrCall(); } } return PlayerAction.CheckOrCall(); }
private PlayerAction PreflopLogic(Card firstCard, Card secondCard, GetTurnContext context) { var playHand = HandStrengthValuation.PreFlop(this.FirstCard, this.SecondCard); if (playHand == CardValuationType.Unplayable) { if (context.CurrentPot < 15 && context.MoneyLeft > 100) { return PlayerAction.CheckOrCall(); } else { return PlayerAction.Fold(); } } else if (playHand == CardValuationType.NotRecommended) { if (!context.CanCheck && context.MyMoneyInTheRound <= 500) { return PlayerAction.Fold(); } } else if (playHand == CardValuationType.Risky) { if (context.MoneyLeft <= 500 && !context.CanCheck) { return PlayerAction.Fold(); } var smallBlindsTimes = RandomProvider.Next(5, 15); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } else if (playHand == CardValuationType.Recommended) { var smallBlindsTimes = RandomProvider.Next(10, 25); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } // default return PlayerAction.Fold(); }
internal PlayerAction DesideByChance(float firstHandProbabillity, GetTurnContext context) { // don't play if chance is less than 50% if (firstHandProbabillity < 0.41f) { if (context.CanCheck) { return PlayerAction.CheckOrCall(); } else { if (context.CurrentPot < (2 * context.SmallBlind)) { var smallBlindsTimes = RandomProvider.Next(1, 6); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } return PlayerAction.Fold(); } } else if (firstHandProbabillity < 0.51f) { var smallBlindsTimes = RandomProvider.Next(5, 20); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } else if (firstHandProbabillity < 0.65f) { var smallBlindsTimes = RandomProvider.Next(15, 30); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } else { var smallBlindsTimes = RandomProvider.Next(25, 100); return PlayerAction.Raise(context.SmallBlind * smallBlindsTimes); } }
public override PlayerAction GetTurn(GetTurnContext context) { // if they raised more than a certain proportion of my money and I don`t have strong hand fold if (context.PreviousRoundActions.Count > 0 && context.PreviousRoundActions.Last().Action.Type == PlayerActionType.Raise) { if (context.MoneyToCall >= context.MoneyLeft / 2 && this.HandStrength < .8) { return PlayerAction.Fold(); } } if (this.HandStrength < .42 && !context.CanCheck) { return PlayerAction.Fold(); } var raise = context.MoneyLeft; if (this.HandStrength > .95 && raise > 0) { return PlayerAction.Raise(raise / 2); } return PlayerAction.CheckOrCall(); }
internal PlayerAction Deside(float[] probabilityOfAllHands, GetTurnContext context, byte bestHand) { PlayerAction action; if (context.RoundType != GameRoundType.River) { if (bestHand < 2) { float maximalProbability = probabilityOfAllHands.Max(); action = DesideByChance(maximalProbability, context); } else { action = DesideByHand(bestHand, context); } } else { action = DesideByHand(bestHand, context); } return action; }
public override PlayerAction GetTurn(GetTurnContext context) { ai.ProcessCurrentRound(context, this.FirstCard, this.SecondCard, this.CommunityCards); return ai.Action; }
public static PlayerAction PassivePlayerActionPreFlop(GetTurnContext context, CardValueType preFlopCards, int raiseAmount, int pushAmount) { if (preFlopCards != CardValueType.Unplayable) { if (preFlopCards == CardValueType.NotRecommended) { if (context.MoneyLeft > 0) { if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind) { return PlayerAction.Raise(context.SmallBlind * raiseAmount); } else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind) { return CheckOrFoldCustomAction(context); } else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 11) { return CheckOrFoldCustomAction(context); } else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 11 && context.MoneyToCall > context.SmallBlind * 6) { return CheckOrFoldCustomAction(context); } else { return PlayerAction.Raise(context.SmallBlind * raiseAmount / 2); } } return CheckOrFoldCustomAction(context); } else if (preFlopCards == CardValueType.Risky) { if (context.MoneyLeft > 0) { if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind) { return PlayerAction.Raise(context.SmallBlind * raiseAmount); } else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind) { return PlayerAction.CheckOrCall(); } else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 21) { return CheckOrFoldCustomAction(context); } else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 21 && context.MoneyToCall > context.SmallBlind * 11) { return CheckOrFoldCustomAction(context); } else { return PlayerAction.Raise(context.SmallBlind * raiseAmount / 2); } } return CheckOrFoldCustomAction(context); } else if (preFlopCards == CardValueType.Recommended) { if (context.MoneyLeft > 0) { if (context.CanCheck && context.MyMoneyInTheRound <= context.SmallBlind) { return PlayerAction.Raise(context.SmallBlind * raiseAmount); } else if (context.CanCheck && context.MyMoneyInTheRound > context.SmallBlind) { return PlayerAction.Raise(context.SmallBlind * pushAmount); } else if (!context.CanCheck && context.MoneyToCall > context.SmallBlind * 41) { return PlayerAction.Raise(context.MoneyLeft); } else if (!context.CanCheck && context.MoneyToCall < context.SmallBlind * 41 && context.MoneyToCall > context.SmallBlind * 11) { return PlayerAction.CheckOrCall(); } else { return PlayerAction.Raise(context.SmallBlind * raiseAmount / 2); } } return PlayerAction.CheckOrCall(); } } return CheckOrFoldCustomAction(context); }
public static PlayerAction PassivePlayerAction(GetTurnContext context, HandRankType combination, int raiseAmount, int pushAmount) { if (CustomHandStreightChecks.GotStrongHand(combination)) { if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotTheStrongestHand(combination)) { if (!context.CanCheck && (context.MoneyToCall > context.CurrentPot / 2 || context.MoneyToCall > context.SmallBlind * 14) && context.MoneyLeft > 0) { return PlayerAction.Raise(context.MoneyLeft); } else if (context.MoneyLeft >= context.SmallBlind * pushAmount) { return PlayerAction.Raise(context.SmallBlind * pushAmount); } else { return PlayerAction.Raise(context.MoneyLeft); } } else if (context.MoneyLeft > 0 && CustomHandStreightChecks.GotVeryStrongHand(combination)) { if (!context.CanCheck && (context.MoneyToCall > context.CurrentPot / 2 * 3 || context.MoneyToCall > context.SmallBlind * 20) && context.MoneyLeft > 0) { return PlayerAction.Raise(context.MoneyLeft); } else if (context.MoneyLeft >= context.SmallBlind * raiseAmount) { return PlayerAction.Raise(context.SmallBlind * raiseAmount); } else { return PlayerAction.Raise(context.MoneyLeft); } } else { if (context.MoneyLeft > 0) { return PlayerAction.Raise(context.SmallBlind * 6); } else { return PlayerAction.CheckOrCall(); } } } else { if (context.CanCheck && context.MoneyLeft > 0) { return PlayerAction.Raise((context.SmallBlind * raiseAmount) - context.SmallBlind); } else if (context.MoneyToCall <= context.SmallBlind * 2) { return PlayerAction.CheckOrCall(); } return CheckOrFoldCustomAction(context); } }
public abstract PlayerAction GetTurn(GetTurnContext context);