///// CLASS LOGIC ///// public List <BestHand> analyzeBoard() { var madeHands = new List <BestHand>(); foreach (T h in this.range.hands) { var ha = new HandAnalyzer(h, this.board); madeHands.Add(ha.bestHand); } madeHands.Sort((x, y) => BestHand.compare(x, y)); return(madeHands); }
// used to ___??? public static WinState determineWinner(Board b, List <PreflopHand> hands) { var analyzers = new Dictionary <string, HandAnalyzer>(); foreach (PreflopHand h in hands) { analyzers.Add(String.Format("hand-{0}", hands.IndexOf(h)), new HandAnalyzer(h, b)); } var winningHands = new List <BestHand>(); // tracks all hands that are due a share of the Pot foreach (KeyValuePair <string, HandAnalyzer> a in analyzers) { BestHand competitor = analyzers[a.Key].bestHand; if (winningHands.Count == 0) { winningHands.Add(competitor); } else { int winner = BestHand.compare(competitor, winningHands[0]); if (winner == 0) { winningHands.Add(competitor); } else if (winner == 1) { winningHands = new List <BestHand>() { competitor }; } } } double equity = PickWinner.calculateEquitySplit(winningHands.Count); return(new WinState(equity, winningHands)); }