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 flopCards = boardCards.GetBoardOnStreet(Street.Flop); var flopPair = boardCards.GroupBy(x => x.Rank).FirstOrDefault(x => x.Count() == 2); if (flopPair != null) { return(flopPair.Any(f => playerCards.Any(p => p.CardIntValue == f.CardIntValue))); } return(false); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet)) { return(false); } var board = boardCards.GetBoardOnStreet(boardTexture.TargetStreet); var lastCard = board.Last(); var grouppedBoard = board.Take(board.Count - 1).GroupBy(x => x.Rank); if (grouppedBoard.Count(x => x.Count() > 1) > 1) { return(false); } var pair = grouppedBoard.FirstOrDefault(x => x.Count() == 2); if (pair == null) { return(false); } return(pair.Key == lastCard.Rank); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet)) { return(false); } var board = boardCards.GetBoardOnStreet(boardTexture.TargetStreet).OrderBy(x => x.RankNumericValue).ToList(); if (board.Any(x => x.RankNumericValue == Cards.Card.GetRankNumericValue("A")) && board.Any(x => x.RankNumericValue == Cards.Card.GetRankNumericValue("4"))) { return(true); } for (int i = 1; i < board.Count; i++) { if (Math.Abs(board[i - 1].RankNumericValue - board[i].RankNumericValue) == 3) { return(true); } } return(false); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet)) { return(false); } return(HandAnalyzerHelpers.IsFlush(boardCards.GetBoardOnStreet(boardTexture.TargetStreet))); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet)) { return(false); } return(boardCards.GetBoardOnStreet(boardTexture.TargetStreet).GroupBy(x => x.Suit).Count() == 3); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet)) { return(false); } var board = boardCards.GetBoardOnStreet(boardTexture.TargetStreet); var lastCard = board.Last(); return(board.Take(board.Count - 1).GroupBy(x => x.Rank).All(x => x.Count() == 1) && board.Take(board.Count - 1).Any(x => x.Rank == lastCard.Rank)); }
public static List <int> GetOrderedBoardNumericRanks(BoardCards boardCards, StraightBoardTextureItem boardTextureItem) { var board = boardCards.GetBoardOnStreet(boardTextureItem.TargetStreet).OrderBy(x => x.RankNumericValue).ToList(); var orderedRanks = board.Select(x => x.RankNumericValue).Distinct().ToList(); if (board.Any(x => x.RankNumericValue == Cards.Card.GetRankNumericValue("A"))) { orderedRanks.Insert(0, 1); } return(orderedRanks); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet) || !(boardTexture is HighCardBoardTextureItem)) { return(false); } var highCardItem = boardTexture as HighCardBoardTextureItem; var board = boardCards.GetBoardOnStreet(highCardItem.TargetStreet); return(board.Aggregate((i1, i2) => i1.RankNumericValue > i2.RankNumericValue ? i1 : i2).Rank == highCardItem.SelectedRank); }
public bool Analyze(BoardCards boardCards, BoardTextureItem boardTexture) { if (!CardHelper.IsStreetAvailable(boardCards.ToString(), boardTexture.TargetStreet)) { return(false); } var board = boardCards.GetBoardOnStreet(boardTexture.TargetStreet).OrderBy(x => x.RankNumericValue).ToList(); var orderedRanks = board.Select(x => x.RankNumericValue).ToList(); if (board.Any(x => x.RankNumericValue == Cards.Card.GetRankNumericValue("A")) && board.Any(x => x.RankNumericValue == Cards.Card.GetRankNumericValue("2"))) { orderedRanks.Insert(0, 1); } int count = 0; for (int i = 1; i < orderedRanks.Count; i++) { if (Math.Abs(orderedRanks[i - 1] - orderedRanks[i]) == 1) { count++; } else if (count == 3) { return(true); } else { count = 0; } } return(count == 3); }