Exemplo n.º 1
0
        private List <PokerDetailInformation> GetWinnerCore(List <PokerDetailInformation> details, ICompare compare)
        {
            if (details == null || details.Count < 1)
            {
                throw new InvalidOperationException("Wrong data");
            }
            if (details.Count == 1)
            {
                return(details);
            }
            var currentWinners = new List <PokerDetailInformation>()
            {
                details[0]
            };

            for (var i = 1; i < details.Count; i++)
            {
                var compareResult = compare.GetWinner(currentWinners.First(), details[i]);
                if (compareResult.Count > 1)
                {
                    currentWinners.Add(details[i]);
                }
                else
                {
                    currentWinners = compareResult;
                }
            }
            return(currentWinners);
        }