public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards) { if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 4) { return(false); } var ten = Cards.Card.GetRankNumericValue("T"); var ace = Cards.Card.GetRankNumericValue("A"); var sortedBoardRanks = boardCards.Select(x => x.RankNumericValue).Where(x => x >= ten && x <= ace).Distinct().ToList(); sortedBoardRanks.Sort(); if (sortedBoardRanks.Count() == 4) { for (int i = ten; i <= ace; i++) { if (sortedBoardRanks.Contains(i)) { continue; } if (playerCards.Any(x => x.RankNumericValue == i)) { return(true); } else { return(false); } } } return(false); }
private string GetBoardStringFormatted() { string boardCards = string.Empty; if (BoardCards != null) { boardCards = string.Join(" ", BoardCards.Select(x => x.ToString())); } return(boardCards); }
public void OmahaEquityCalcTest(string boardCards, bool isHiLo, float[] equity) { BoardCards board = BoardCards.FromCards(boardCards); var cards = GetHoleCards().Select(x => CardGroup.Parse(x).Select(c => c.ToString()).ToArray()).ToArray(); OmahaEquityCalculatorMain calc = new OmahaEquityCalculatorMain(true, isHiLo); var result = calc.Equity(board.Select(x => x.ToString()).ToArray(), cards, new string[] { }, 0); var i = 0; }
/// <summary> /// Calculates Omaha equity for the specified players which last action was at the specified street /// </summary> /// <param name="players">Player to calculate equity</param> /// <param name="street">Street</param> /// <param name="boardCards">Board cards</param> /// <param name="isHiLo">Determine whenever Omaha is Omaha HiLo</param> private void CalculateOmahaEquity(List <EquityPlayer> players, Street street, BoardCards boardCards, bool isHiLo, int potIndex) { var calc = new OmahaEquityCalculatorMain(true, isHiLo); var eq = calc.Equity(boardCards.Select(x => x.ToString()).ToArray(), players.Select(x => x.HoleCards.Select(c => c.ToString()).ToArray()).ToArray(), new string[] { }, 0); var allInEquity = new Dictionary <string, decimal>(); for (var i = 0; i < eq.Length; i++) { var player = players.Count > i ? players[i] : null; if (player != null && !allInEquity.ContainsKey(player.Name)) { var equity = (decimal)eq[i].TotalEq / 100; allInEquity.Add(player.Name, equity); } } players.Where(p => p.LastAction.Street == street && allInEquity.ContainsKey(p.Name)) .ForEach(p => p.Equity[potIndex] = allInEquity[p.Name]); }