private void AppendActionsSubstatistics(HoldemGamePhase phase, Statistic statistic, MultipleValueCounter ratings) { float sum = (float)ratings.GetSumOfAllValuesIn(phase); foreach (HoldemHand.Rating rating in Enum.GetValues(typeof(HoldemHand.Rating))) { if (sum == 0) statistic.AddSubStatistic(new StatisticsUnknownData(rating.ToString())); else { float ratio = (float)ratings[phase, rating].Value / sum; statistic.AddSubStatistic(new StatisticsPercentageData(rating.ToString(), ratio)); } } }
/* Returns the limp statistics */ public Statistic GetLimpStats() { float limpRatio = 0; if (totalHandsPlayed.Value == 0) limpRatio = 0; else limpRatio = (float)limps.Value / (float)totalHandsPlayed.Value; Statistic ret = new Statistic(new StatisticsPercentageData("Limp", limpRatio), "Preflop"); // Advanced statistics float sum = (float)limpsDetails.GetSumOfAllValues(); foreach (HoldemHand.Rating rating in Enum.GetValues(typeof(HoldemHand.Rating))) { if (sum == 0) ret.AddSubStatistic(new StatisticsUnknownData(rating.ToString())); else { float ratio = (float)limpsDetails[rating].Value / sum; ret.AddSubStatistic(new StatisticsPercentageData(rating.ToString(), ratio)); } } return ret; }
private Statistic CreateOutsStatistic(String name, int numOuts, HoldemGamePhase phase) { Trace.Assert(phase == HoldemGamePhase.Flop || phase == HoldemGamePhase.Turn, "Cannot create outs statistics for a phase different than flop or turn."); float value = 0.0f; if (phase == HoldemGamePhase.Flop) { value = GetOutsPercentage(numOuts, OutsByThe.Turn); } else if (phase == HoldemGamePhase.Turn) { value = GetOutsPercentage(numOuts, OutsByThe.River); } Statistic result = new Statistic(new StatisticsOddsData(name, value, PRECISION)); // The flop has extra information as we want to see the chances of hitting // something by the turn, or by the turn and river combined if (phase == HoldemGamePhase.Flop) { float valueByTurnOrRiver = GetOutsPercentage(numOuts, OutsByThe.TurnOrRiver); result.AddSubStatistic(new StatisticsOddsData("By the turn", value, PRECISION)); result.AddSubStatistic(new StatisticsOddsData("By the turn or river", valueByTurnOrRiver, PRECISION)); } return result; }