public static RoyalFlush CreateInstance(IEnumerable <Card> communityCards, IEnumerable <Card> holeCards) { throw new NotImplementedException(); Utils.Validate(communityCards, holeCards); if (GetRoyalFlush(communityCards).Any()) { //If the RoyalFlush is in the community cards then it doesnt count. return(null); } var allCards = new List <Card>(communityCards); allCards.AddRange(holeCards); var rfCards = GetRoyalFlush(allCards); if (!rfCards.Any()) { return(null); } var royalflush = new RoyalFlush(rfCards); return(royalflush); }
internal static RoyalFlush CreateInstance(IEnumerable <Card> cards) { Utils.Validate(cards); if (!cards.All(c => c.IsRoyal())) { return(null); } var suit = cards.First().Suit; if (!cards.All(c => c.Suit == suit)) { return(null); } var royalflush = new RoyalFlush(cards); return(royalflush); }