Exemplo n.º 1
0
        private Decision GetDecisionAgainstThreeBet(PreflopStatusSummary statusSummary, RangeGrid grid, PositionEnum threeBetPosition)
        {
            Logger.Instance.Log($"Pot three bet by {threeBetPosition}, GetDecisionAgainstThreeBet called.");
            var fourBetChart = ChartUtils.GetDecisionAgainstThreeBetChart(statusSummary.Me.Position, threeBetPosition);
            var decision     = fourBetChart.Get(grid);

            switch (decision)
            {
            case DecisionAgainstThreeBetEnum.Fold:
                Logger.Instance.Log($"FourBetChart says decision=Fold, grid={grid}, returning decision of Fold.");
                return(new Decision(DecisionType.Fold, 0));

            case DecisionAgainstThreeBetEnum.Call:
                Logger.Instance.Log($"FourBetChart says decision=Call, grid={grid}, returning decision of Call.");
                return(new Decision(DecisionType.Call, statusSummary.ChipsToCall));

            case DecisionAgainstThreeBetEnum.BluffFourBet:
            case DecisionAgainstThreeBetEnum.ValueFourBet:
                int chipsToAdd = GetFourBetSize(statusSummary);
                Logger.Instance.Log($"FourBetChart says decision={decision}, grid={grid}, returning decision=Reraise, chipsToAdd={chipsToAdd}.");
                return(new Decision(DecisionType.Reraise, chipsToAdd));

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 2
0
        private Decision GetDecisionAgainstOpenRaise(PreflopStatusSummary statusSummary, RangeGrid grid, PositionEnum openRaisePosition)
        {
            Logger.Instance.Log($"Pot open raised by {openRaisePosition}, GetDecisionAgainstOpenRaise called.");
            var threeBetChart = ChartUtils.GetDecisionAgaisntOpenRaiseChart(statusSummary.Me.Position, openRaisePosition);
            var decision      = threeBetChart.Get(grid);

            switch (decision)
            {
            case DecisionAgainstOpenRaiseEnum.Fold:
                Logger.Instance.Log($"ThreeBetChart says decision=Fold, grid={grid}, returning decision of Fold.");
                return(new Decision(DecisionType.Fold, 0));

            case DecisionAgainstOpenRaiseEnum.Call:
                Logger.Instance.Log($"ThreeBetChart says decision=Call, grid={grid}, returning decision of Call.");
                return(new Decision(DecisionType.Call, statusSummary.ChipsToCall));

            case DecisionAgainstOpenRaiseEnum.BluffThreeBet:
            case DecisionAgainstOpenRaiseEnum.ValueThreeBet:
                int chipsToAdd = GetThreeBetSize(statusSummary);
                Logger.Instance.Log($"ThreeBetChart says decision={decision}, grid={grid}, returning decision=Reraise, chipsToAdd={chipsToAdd}.");
                return(new Decision(DecisionType.Reraise, chipsToAdd));

            default:
                throw new InvalidCastException();
            }
        }
        private Decision GenerateDecisionFromHandGrade(HandValueGradeEnum handGrade, PreflopStatusSummary statusSummary)
        {
            DecisionType decisionType = TranslateBasedOnIsRaised(handGrade, statusSummary);
            int          chipsAdded   = _betSizeConsultant.GetBetSize(statusSummary, decisionType);

            return(new Decision(decisionType, chipsAdded));
        }
Exemplo n.º 4
0
        public IHandGrader GenerateHandGrader(PreflopStatusSummary statusSummary)
        {
            switch (statusSummary.Me.Position)
            {
            case PositionEnum.SmallBlind:
                return(new EvPercentileHandGrader(_sbPercentileConsultant.GetPercentiles(statusSummary)));

            case PositionEnum.BigBlind:
                return(new EvPercentileHandGrader(_bbPercentileConsultant.GetPercentiles(statusSummary)));

            default:
                return(new EvPercentileHandGrader(_percentileConsultant.GetPercentiles(statusSummary)));
            }
        }
Exemplo n.º 5
0
        private Decision GetDecisionOnUnraisedPot(PreflopStatusSummary statusSummary, RangeGrid grid)
        {
            Logger.Instance.Log($"Pot not raised, GetDecisionOnUnraisedPot called.");
            var openRaiseChart = ChartUtils.GetOpenRaiseChart(statusSummary.Me.Position);
            var shouldRaise    = openRaiseChart.Get(grid);

            if (shouldRaise)
            {
                var chipsToAdd = GetOpenRaiseSize(statusSummary);
                Logger.Instance.Log($"OpenRaiseChart says shouldRaise=true, grid={grid}, returning decision of Raise, chipsToAdd={chipsToAdd}.");
                return(new Decision(DecisionType.Raise, chipsToAdd));
            }
            else
            {
                Logger.Instance.Log($"OpenRaiseChart says shouldRaise=false, grid={grid}, returning decision of Fold.");
                return(new Decision(DecisionType.Fold, 0));
            }
        }
Exemplo n.º 6
0
        private Decision GetDecisionAgainstFiveBet(PreflopStatusSummary statusSummary, RangeGrid grid,
                                                   PositionEnum fiveBetPosition)
        {
            var fourBetChart = ChartUtils.GetDecisionAgainstThreeBetChart(statusSummary.Me.Position, fiveBetPosition);
            var decision     = fourBetChart.Get(grid);

            switch (decision)
            {
            case DecisionAgainstThreeBetEnum.Fold:
            case DecisionAgainstThreeBetEnum.Call:
                throw new InvalidOperationException("Should not four bet in the first place");

            case DecisionAgainstThreeBetEnum.BluffFourBet:
                return(new Decision(DecisionType.Fold, 0));

            case DecisionAgainstThreeBetEnum.ValueFourBet:
                return(new Decision(DecisionType.Call, statusSummary.ChipsToCall));

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 7
0
        private Decision GetDecisionAgainstFourBet(PreflopStatusSummary statusSummary, RangeGrid grid,
                                                   PositionEnum fourBetPosition)
        {
            var threeBetChart = ChartUtils.GetDecisionAgaisntOpenRaiseChart(statusSummary.Me.Position, fourBetPosition);
            var decision      = threeBetChart.Get(grid);

            switch (decision)
            {
            case DecisionAgainstOpenRaiseEnum.Fold:
            case DecisionAgainstOpenRaiseEnum.Call:
                throw new InvalidOperationException("Should not three bet in the first place");

            case DecisionAgainstOpenRaiseEnum.BluffThreeBet:
                return(new Decision(DecisionType.Fold, 0));

            case DecisionAgainstOpenRaiseEnum.ValueThreeBet:
                return(new Decision(DecisionType.Reraise, GetAllInSize(statusSummary)));

            default:
                throw new InvalidCastException();
            }
        }
        private DecisionType TranslateBasedOnIsRaised(HandValueGradeEnum handGrade, PreflopStatusSummary statusSummary)
        {
            switch (handGrade)
            {
            case HandValueGradeEnum.AllIn:
                return(DecisionType.AllIn);

            case HandValueGradeEnum.BetForValue:
                return(statusSummary.IsRaised ? DecisionType.Reraise : DecisionType.Raise);

            case HandValueGradeEnum.Flat:
                return(DecisionType.Call);

            case HandValueGradeEnum.BetForBluff:
                return(statusSummary.IsRaised ? DecisionType.Reraise : DecisionType.Raise);

            case HandValueGradeEnum.Fold:
                return(DecisionType.Fold);

            default:
                throw new NotImplementedException();
            }
        }
Exemplo n.º 9
0
        public Decision MakeDecision(PreflopStatusSummary statusSummary, HoldingHoles holes)
        {
            Logger.Instance.Log($"ChartPreflopStrategy to make decision. HeroHoles={holes.Hole1.GetStringForCard()},{holes.Hole2.GetStringForCard()}");

            var raiseMoves = FilterRaiseMoves(statusSummary.PreflopRaiseMoves, p => p.Name == statusSummary.Me.Name);

            Logger.Instance.Log($"Filtered raise moves: {string.Join("/", raiseMoves.Select(m => m.GetStringForMove()))}");
            var grid = new RangeGrid(holes);

            if (raiseMoves.Count == 0)
            {
                return(GetDecisionOnUnraisedPot(statusSummary, grid));
            }

            if (raiseMoves.Count == 1)
            {
                return(GetDecisionAgainstOpenRaise(statusSummary, grid, raiseMoves[0].Player.Position));
            }

            if (raiseMoves.Count == 2)
            {
                return(GetDecisionAgainstThreeBet(statusSummary, grid, raiseMoves[1].Player.Position));
            }

            if (raiseMoves.Count == 3)
            {
                return(GetDecisionAgainstFourBet(statusSummary, grid, raiseMoves[2].Player.Position));
            }

            if (raiseMoves.Count == 4)
            {
                return(GetDecisionAgainstFiveBet(statusSummary, grid, raiseMoves[3].Player.Position));
            }

            throw new NotSupportedException();
        }
Exemplo n.º 10
0
        public int GetBetSize(PreflopStatusSummary statusSummary, DecisionType decisionType)
        {
            switch (decisionType)
            {
            case DecisionType.Call:
                return(statusSummary.ChipsToCall);

            case DecisionType.Fold:
                return(0);

            case DecisionType.Check:
                return(0);

            case DecisionType.AllIn:
                return(statusSummary.Me.StackSize);

            case DecisionType.Raise:
            case DecisionType.Reraise:
                return(Math.Max((int)(statusSummary.ChipsToCall * 1.5), Math.Min((int)(statusSummary.PotSize * 0.5), statusSummary.Me.StackSize)));
            }

            //todo: this method should contain more logics than above
            throw new NotImplementedException();
        }
Exemplo n.º 11
0
 private int GetAllInSize(PreflopStatusSummary statusSummary)
 {
     return(statusSummary.BigBlindSize * 72);
 }
Exemplo n.º 12
0
 private int GetFourBetSize(PreflopStatusSummary statusSummary)
 {
     return(statusSummary.BigBlindSize * 24);
 }
Exemplo n.º 13
0
 private int GetThreeBetSize(PreflopStatusSummary statusSummary)
 {
     return(statusSummary.BigBlindSize * 8);
 }
Exemplo n.º 14
0
 private int GetOpenRaiseSize(PreflopStatusSummary statusSummary)
 {
     return(statusSummary.BigBlindSize * 3);
 }
Exemplo n.º 15
0
        public Decision MakeDecision(PreflopStatusSummary statusSummary, StartingHand startingHand)
        {
            var handGrade = _handRangeConsultant.GenerateHandGrader(statusSummary).GradeAHand(startingHand);

            return(GenerateDecisionFromHandGrade(handGrade, statusSummary));
        }
Exemplo n.º 16
0
 public Decision GetPreflopDecision(PreflopStatusSummary statusSummary, HoldingHoles heroHoles)
 {
     return(_preflopStrategy.MakeDecision(statusSummary, GetStartingHand(heroHoles.Hole1, heroHoles.Hole2)));
 }