示例#1
0
        public GameAction Action(GameState state)
        {
            var pWin = PokerHandEvaluator.Calculate(state.Own.Hand, state.Table, this.Rnd, 5000);

            if (state.IsPreFlop && pWin < 0.40 && state.AmountToCall > 0)
            {
                return(GameAction.Fold);
            }
            if (state.MaxinumRaise > 0)
            {
                if (pWin > 0.65 && state.AmountToCall == 0)
                {
                    return(GameAction.Raise(state.MaxinumRaise));
                }
                if (pWin > 0.55 && state.AmountToCall == 0)
                {
                    return(GameAction.Raise(state.MinimumRaise));
                }
                if (pWin > 0.7)
                {
                    return(GameAction.Raise(state.MaxinumRaise));
                }
            }
            if (pWin < 0.35 && state.AmountToCall > 0)
            {
                return(GameAction.Fold);
            }

            return(GameAction.CheckOrCall(state));
        }
        public GameAction Action(GameState state, MT19937Generator rnd)
        {
            if (state.Own.Stack <= 0)
            {
            }

            var pWin = PokerHandEvaluator.Calculate(state.Own.Hand, state.Table, rnd, 10);

            // Only play doable small blinds.
            if (state.IsPreFlop && pWin < 0.4 && state.AmountToCall > 0)
            {
                return(GameAction.Fold);
            }
            if (state.MaxinumRaise > 0)
            {
                if (pWin > 0.55 && state.AmountToCall == 0)
                {
                    return(GameAction.Raise(state.MaxinumRaise));
                }
                if (pWin > 0.7)
                {
                    return(GameAction.Raise(state.MaxinumRaise));
                }
            }
            if (pWin < 0.35 && state.AmountToCall > 0)
            {
                return(GameAction.Fold);
            }

            return(GameAction.CheckOrCall(state));
        }
示例#3
0
 public GameAction Action(GameState state)
 {
     if (state.MaxinumRaise > 0)
     {
         return(GameAction.Raise(state.MaxinumRaise));
     }
     return(GameAction.CheckOrCall(state));
 }
示例#4
0
 /// <summary>Gets the action.</summary>
 /// <remarks>
 /// If the amount to call is bigger than zero, and the pot is will be filled
 /// with a least 4 times the big blindm fold.
 ///
 /// Otherwise call or check.
 /// </remarks>
 public GameAction Action(GameState state)
 {
     if (state.AmountToCall > 0 && (state.Pot + state.AmountToCall) >= 4 * state.BigBlind)
     {
         return(GameAction.Fold);
     }
     return(GameAction.CheckOrCall(state));
 }
示例#5
0
 private GameAction RaiseIfPossible(GameState state)
 {
     if (state.MaxinumRaise > 0)
     {
         var raise = Rnd.Next(state.MinimumRaise, state.MaxinumRaise + 1);
         return(GameAction.Raise(raise));
     }
     return(GameAction.CheckOrCall(state));
 }
示例#6
0
        public GameAction Action(GameState state)
        {
            switch (Rnd.Next(0, 8))
            {
            case 0: return(FoldOnRequiredCall(state));

            case 1:
            case 2:
            case 3: return(RaiseIfPossible(state));

            default: return(GameAction.CheckOrCall(state));
            }
        }
        public GameAction Action(GameState state)
        {
            var change = PokerHandEvaluator.Calculate(state.Own.Hand, state.Table, this.Rnd);

            if (change > 0.8 && state.MaxinumRaise > 0)
            {
                return(GameAction.Raise(state.MaxinumRaise));
            }

            if (state.IsPreFlop && state.AmountToCall == state.SmallBlind && change < 0.52)
            {
                return(GameAction.Fold);
            }
            if (state.AmountToCall > 0 && change < 0.51)
            {
                return(GameAction.Fold);
            }

            return(GameAction.CheckOrCall(state));
        }
        public GameAction Action(GameState state)
        {
            var change = PokerHandEvaluator.Calculate(state.Own.Hand, state.Table, this.Rnd);

            // Only play doable small blinds.
            if (state.IsPreFlop && change < 0.4 && state.AmountToCall == state.SmallBlind)
            {
                return(GameAction.Fold);
            }
            // Don't play bad hands on pre flop if we have to call.
            if (state.IsPreFlop && change < 0.3 && state.AmountToCall >= state.BigBlind)
            {
                return(GameAction.Fold);
            }

            if (state.MaxinumRaise > 0)
            {
                // It's look like we're winning, use brute force.
                if (state.Own.Chips / state.Opp.Chips > 2.5 && change > 0.7 && state.MaxinumRaise > 0)
                {
                    return(GameAction.Raise(state.MaxinumRaise));
                }
                if (change > 0.75 && state.MaxinumRaise > 0)
                {
                    var raise = state.MaxinumRaise * change * change;
                    return(GameAction.Raise((int)raise));
                }
            }
            if (change < 0.35 && state.AmountToCall > 0)
            {
                var treshold = this.Rnd.Next();

                var situation = (double)(state.AmountToCall + state.Own.Pot) / (double)(state.Own.Pot + state.Own.Stack);

                if (treshold < situation)
                {
                    return(GameAction.Fold);
                }
            }
            return(GameAction.CheckOrCall(state));
        }
        public void CheckOrCall_StateWithNoAmountToCall_Check()
        {
            var state = new GameState()
            {
                YourBot = PlayerType.player1,
                Player1 = new PlayerState()
                {
                    Stack = 1980,
                    Pot   = 20,
                },
                Player2 = new PlayerState()
                {
                    Stack = 1980,
                    Pot   = 20,
                },
            };

            state.AmountToCall = state.GetAmountToCall(PlayerType.player1);

            var act = GameAction.CheckOrCall(state);
            var exp = GameAction.Check;

            Assert.AreEqual(exp, act);
        }