private PlayerAction ToValueBet(IGetTurnExtendedContext context, PlayerEconomy playerEconomy)
        {
            double lowerLimit, upperLimit;

            if (playerEconomy.NutHand)
            {
                lowerLimit = LowerWagerLimit;
                upperLimit = 0.75;
            }
            else if (playerEconomy.BestHand)
            {
                lowerLimit = 0.5;
                upperLimit = 1.25;
            }
            else
            {
                lowerLimit = LowerWagerLimit;
                upperLimit = 1.25;
            }

            var min        = (int)(context.CurrentPot * lowerLimit) - context.MoneyToCall;
            var max        = (int)((context.CurrentPot + 1) * upperLimit) - context.MoneyToCall;
            var difference = max - min;

            min = min >= context.MinRaise ? min : context.MinRaise;
            max = max > min ? max : min + difference;

            var moneyToRaise = RandomProvider.Next(min, max);

            if (this.IsPush(moneyToRaise, context))
            {
                return(this.RaiseOrAllIn(int.MaxValue, context));
            }
            else
            {
                return(this.RaiseOrAllIn(moneyToRaise, context));
            }
        }
        private PlayerAction ReactionCausedByWeakHand(IGetTurnExtendedContext context, PlayerEconomy playerEconomy)
        {
            var investment = (int)playerEconomy.OptimalInvestment(context.CurrentPot);

            if (investment < context.MoneyToCall)
            {
                return(PlayerAction.Fold());
            }

            if (context.CanRaise)
            {
                if (investment >= context.MoneyToCall + context.MinRaise)
                {
                    if (context.CurrentPot * LowerWagerLimit <= investment && this.NeedAnRaiseToAdjustTheStats(context))
                    {
                        if (this.IsPush(investment - context.MoneyToCall, context))
                        {
                            // it's a very losing action
                            // return this.RaiseOrAllIn(int.MaxValue, context);
                        }
                        else
                        {
                            return(this.RaiseOrAllIn(investment - context.MoneyToCall, context));
                        }
                    }
                }
            }

            return(PlayerAction.CheckOrCall());
        }
        private PlayerAction ReactionCausedByBestHand(IGetTurnExtendedContext context, PlayerEconomy playerEconomy)
        {
            if (playerEconomy.TiedHandsWithHero > 0)
            {
                if (context.CanRaise && playerEconomy.HandsThatLoseToTheHero.Count > 0)
                {
                    if (this.NeedAnRaiseToAdjustTheStats(context))
                    {
                        return(this.ToValueBet(context, playerEconomy));
                    }
                }
            }
            else
            {
                if (context.CanRaise)
                {
                    if (this.NeedAnRaiseToAdjustTheStats(context))
                    {
                        return(this.ToValueBet(context, playerEconomy));
                    }
                }
            }

            return(PlayerAction.CheckOrCall());
        }
        private PlayerAction ReactionCausedByNutHand(IGetTurnExtendedContext context, PlayerEconomy playerEconomy)
        {
            if (context.CanRaise)
            {
                if (this.NeedAnRaiseToAdjustTheStats(context))
                {
                    return(this.ToValueBet(context, playerEconomy));
                }
            }

            return(PlayerAction.CheckOrCall());
        }