public Decision MakeDecision(FlopDecisionContext context) { var probabilityResult = _probabilityCalculator.Calculate(context.HeroHoles, context.HeadsUpVillain); int betSize = Common.Utils.GetBetSize(context.CurrentPotSize); int potSize = context.CurrentPotSize; var ev = probabilityResult.Probabilities[ProbabilityEnum.Fold] * potSize + probabilityResult.Probabilities[ProbabilityEnum.CallLose] * (potSize + betSize) - probabilityResult.Probabilities[ProbabilityEnum.CallWin] * betSize + probabilityResult.Probabilities[ProbabilityEnum.CallTie] * (potSize + betSize) / 2; if (Common.Utils.EvProfitable(ev, potSize, betSize)) { return(new Decision(DecisionType.Raise, betSize)); } return(new Decision(DecisionType.Check, 0)); }
private Decision MakeCallDecision(FlopDecisionContext context) { List <VillainProbabilityResult> probabilityResults = context.AliveVillains.Select(villain => _probabilityCalculator.Calculate(context.HeroHoles, villain, Common.Utils.VillainFoldable(context.FlopRaiser, context.Hero, villain))).ToList(); List <List <ProbabilityTuple> > tupleLists = Common.Utils.EnumerateProbabilities(0, probabilityResults).ToList(); foreach (var tupleList in tupleLists) { Logger.Instance.Log($"{string.Join(";", tupleList.Select(t => $"{t.VillainName}-{t.ProbabilityCategory}-{t.Probability}"))}"); } int callSize = context.FlopRaiser.FlopBet - context.Hero.FlopBet; int potSize = context.CurrentPotSize; double ev = tupleLists.Sum(tupleList => Common.Utils.CalculateEv(tupleList, callSize, potSize)); Logger.Instance.Log($"{callSize} to call a pot of size {potSize}, ev={ev}"); if (Common.Utils.EvProfitable(ev, potSize, callSize)) { Logger.Instance.Log($"Profitable, calling"); return(new Decision(DecisionType.Call, callSize)); } Logger.Instance.Log($"Not profitable, folding"); return(new Decision(DecisionType.Fold, 0)); }
public Decision MakeDecision(FlopDecisionContext context) { List <VillainProbabilityResult> probabilityResults = context.AliveVillains.Select(villain => _probabilityCalculator.Calculate(context.HeroHoles, villain)).ToList(); List <List <ProbabilityTuple> > tupleLists = Common.Utils.EnumerateProbabilities(0, probabilityResults).ToList(); foreach (var tupleList in tupleLists) { Logger.Instance.Log($"{string.Join(";", tupleList.Select(t => $"{t.VillainName}-{t.ProbabilityCategory}-{t.Probability}"))}"); } int betSize = Common.Utils.GetBetSize(context.CurrentPotSize); int potSize = context.CurrentPotSize; double ev = tupleLists.Sum(tupleList => Common.Utils.CalculateEv(tupleList, betSize, potSize)); Logger.Instance.Log($"{betSize} to bet a pot of size {potSize}, ev={ev}"); if (Common.Utils.EvProfitable(ev, potSize, betSize)) { return(new Decision(DecisionType.Raise, betSize)); } return(new Decision(DecisionType.Check, 0)); }