public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 3) { return(false); } var allCards = boardCards.ToList(); allCards.AddRange(playerCards); if (HandAnalyzerHelpers.IsPair(playerCards, 1) || HandAnalyzerHelpers.IsNofKind(boardCards, 3) || !HandAnalyzerHelpers.IsNofKind(allCards, 3)) { return(false); } if (boardCards.Count(x => x.RankNumericValue == boardCards.Max(b => b.RankNumericValue)) == 2 && playerCards.Any(x => x.RankNumericValue == boardCards.Max(b => b.RankNumericValue))) { var kicker = playerCards.FirstOrDefault(p => !boardCards.Any(b => b.Rank == p.Rank)); if (kicker != null) { return(HandAnalyzerHelpers.IsWeakKicker(kicker)); } } return(false); }
public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 2) { return(false); } if (HandAnalyzerHelpers.IsPair(playerCards, 1)) { return(false); } var allCards = HandAnalyzerHelpers.CombineCardLists(boardCards, playerCards); if (HandAnalyzerHelpers.IsNofKind(allCards, 3) || HandAnalyzerHelpers.IsNofKind(allCards, 4)) { return(false); } var pairs = allCards.GroupBy(x => x.RankNumericValue).Where(x => x.Count() == 2); if (pairs != null && pairs.Count() > 1) { var topPair = boardCards.Max(x => x.RankNumericValue); return(pairs.First().Key == topPair && playerCards.Any(x => x.RankNumericValue == topPair) && !playerCards.Any(x => pairs.ElementAt(1).Key == x.RankNumericValue)); } return(false); }
public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 2) { return(false); } if (!HandAnalyzerHelpers.IsPair(playerCards, 1)) { return(false); } var allCards = boardCards.ToList(); allCards.AddRange(playerCards); var pairs = allCards.GroupBy(x => x.RankNumericValue).Where(x => x.Count() == 2); if (pairs != null && pairs.Count() > 1) { return(playerCards.First().RankNumericValue > boardCards.Max(x => x.RankNumericValue)); } return(false); }
public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 3) { return(false); } var allCards = boardCards.ToList(); allCards.AddRange(playerCards); if (!HandAnalyzerHelpers.IsPair(playerCards, 1) || !HandAnalyzerHelpers.IsNofKind(allCards, 3)) { return(false); } var topBoardCardRank = boardCards.Max(x => x.RankNumericValue); if (playerCards.Any(x => x.RankNumericValue == topBoardCardRank)) { return(true); } return(false); }
public virtual bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() == 0) { return(false); } var allCards = HandAnalyzerHelpers.CombineCardLists(boardCards, playerCards); if (HandAnalyzerHelpers.IsPair(playerCards, 1) || !HandAnalyzerHelpers.IsPair(allCards, 1)) { return(false); } if (playerCards.Any(c => c.RankNumericValue == boardCards.Max(x => x.RankNumericValue))) { return(true); } return(false); }
public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() == 0) { return(false); } HoldemHand.Hand hand = new HoldemHand.Hand(string.Join("", playerCards.Select(c => c.CardStringValue)), boardCards.ToString()); if (hand.HandTypeValue > HoldemHand.Hand.HandTypes.Pair) { return(true); } if (hand.HandTypeValue == HoldemHand.Hand.HandTypes.Pair) { return(playerCards.Any(x => x.RankNumericValue == boardCards.Max(b => b.RankNumericValue))); } return(false); }
public bool Analyze(IEnumerable <Cards.Card> playerCards, BoardCards boardCards) { if (boardCards == null || boardCards.Count != 5) { return(false); } if (HandAnalyzerHelpers.IsStraight(boardCards, true)) { if (boardCards.Any(x => x.Rank == Cards.Card.PossibleRanksHighCardFirst.First()) && boardCards.Any(x => x.Rank == Cards.Card.PossibleRanksHighCardFirst.Last())) { return(!playerCards.Any(x => x.RankNumericValue == (boardCards .Where(b => b.Rank != Cards.Card.PossibleRanksHighCardFirst.First()) .Max(m => m.RankNumericValue) + 1))); } else { return(!playerCards.Any(x => x.RankNumericValue == (boardCards.Max(m => m.RankNumericValue) + 1))); } } return(false); }