コード例 #1
0
        public bool IsMatched(PokerDetail detail)
        {
            if (detail == null)
            {
                throw new System.ArgumentNullException(nameof(detail));
            }

            return(detail.CardDetail.All(x => x.Value == 1));
        }
コード例 #2
0
 public PokerHands GetPokerHands(PokerDetail detail)
 {
     foreach (var rule in _rules)
     {
         if (rule.IsMatched(detail))
         {
             return(rule.CurrentPokerHand);
         }
     }
     // throw an error if there is no rule can match the detail
     throw new InvalidOperationException("Rules Missing, Check your rules first.");
 }