Пример #1
0
        /// <summary>
        /// Calculates EV Diff for the players involved into the specified pots
        /// </summary>
        /// <param name="pot">Pots to calculate EV diff</param>
        /// <param name="handHistory">Hand history</param>
        /// <param name="gameType">Type of game</param>
        private void CalculateEvDiff(EquityPot pot, HandHistory handHistory, GeneralGameTypeEnum gameType)
        {
            if (pot.Players
                .Where(x => x.HoleCards != null)
                .Count() < 2)
            {
                return;
            }

            var pokerEvaluator = ServiceLocator.Current.GetInstance <IPokerEvaluator>(gameType.ToString());

            pokerEvaluator.SetCardsOnTable(handHistory.CommunityCards);

            pot.Players
            .Where(x => x.HoleCards != null)
            .ForEach(x => pokerEvaluator.SetPlayerCards(x.Seat, x.HoleCards));

            var winners = pokerEvaluator.GetWinners();

            if (winners.Lo == null || winners.Lo.IsNullOrEmpty())
            {
                CalculateEvDiffByPot(pot, handHistory, winners.Hi.ToList());
                return;
            }

            var splitPot = new EquityPot
            {
                Index           = pot.Index,
                Players         = pot.Players,
                PlayersPutInPot = pot.PlayersPutInPot,
                Pot             = pot.Pot / 2,
                Rake            = pot.Rake / 2,
                Street          = pot.Street
            };

            CalculateEvDiffByPot(splitPot, handHistory, winners.Hi.ToList());
            CalculateEvDiffByPot(splitPot, handHistory, winners.Lo.ToList());
        }