Пример #1
0
        public double CalculateEquity(HoldingHoles heroHoles, PlayerRange villainRange)
        {
            var pkStage  = new PkStage(_fiveCardsEnumerator.Enumerate, Utils.EnumerateAvailableHoles);
            var pkResult = pkStage.Pk(heroHoles, villainRange.CloneToPkRange());

            return((double)pkResult.HeroWinScenariosCount /
                   (pkResult.HeroWinScenariosCount + pkResult.VillainWinScenariosCount + pkResult.TiedScenariosCount));
        }
        public VillainProbabilityResult Calculate(HoldingHoles heroHoles, PlayerRoundProfile villainProfile, bool considerFolding = true)
        {
            var pkStage      = new PkStage(_enumerate, Utils.EnumerateUnfoldedHoles);
            var villainRange = villainProfile.PlayerRange.CloneToPkRange();

            var aliveRanges = villainRange.GetAliveGrids();
            int foldCombos = 0, totalCombos = 0;

            foreach (var playerGrid in aliveRanges)
            {
                if (considerFolding)
                {
                    SetFoldToBoard(playerGrid);
                    foldCombos += playerGrid.FoldCombCount;
                }
                totalCombos += playerGrid.AvailableCombCount;
            }

            double villainFoldP = (double)foldCombos / totalCombos;
            double villainCallP = 1 - villainFoldP;

            var pkResult = pkStage.Pk(heroHoles, villainRange);

            int totalGrids = pkResult.HeroWinScenariosCount + pkResult.TiedScenariosCount +
                             pkResult.VillainWinScenariosCount + pkResult.VillainFoldCount;

            double villainCallWinP  = villainCallP * pkResult.VillainWinScenariosCount / totalGrids;
            double villainCallLoseP = villainCallP * pkResult.HeroWinScenariosCount / totalGrids;
            double tieP             = villainCallP * pkResult.TiedScenariosCount / totalGrids;

            return(new VillainProbabilityResult(new Dictionary <ProbabilityEnum, double>()
            {
                { ProbabilityEnum.Fold, villainFoldP },
                { ProbabilityEnum.CallWin, villainCallWinP },
                { ProbabilityEnum.CallTie, tieP },
                { ProbabilityEnum.CallLose, villainCallLoseP }
            },
                                                villainProfile.Name));
        }