Пример #1
0
 public Statistic(StatisticsData mainData, String category)
 {
     this.mainData = mainData;
     this.category = category;
     this.Order = 0;
     this.subData = new List<StatisticsData>();
 }
Пример #2
0
        public override StatisticsData Average(String name, int precision, params StatisticsData[] stats)
        {
            Trace.Assert(stats.Length > 0, "Cannot compute the average of zero elements.");

            // Make sure that the stats we have at least one non-unknown value (otherwise this method will cause an
            // infinite loop
            bool allUnknown = true;
            for (int j = 0; j < stats.Length; j++)
            {
                if (!(stats[j] is StatisticsUnknownData))
                {
                    allUnknown = false;
                    break;
                }
            }

            if (allUnknown) return new StatisticsUnknownData(name);
            else
            {
                // This statistics does not know its value, so we take the first element in the other statistics
                // And calculate the average through them

                StatisticsData[] newParams = new StatisticsData[stats.Length];
                int i;
                for (i = 0; i < stats.Length - 1; i++)
                {
                    newParams[i] = stats[i + 1];
                }
                newParams[i] = this;

                return stats[0].Average(name, precision, newParams);
            }
        }
Пример #3
0
        private void toggleIsDonkIcon(PlayerStatistics stats)
        {
            // If a person is betting/raising/check raising with nothing more than 10%, he's bluffing more than usual
            // 10% is considered to be a standard "bluffing percentage" you can expect. More than that, is donkish
            StatisticsData nothingBets        = stats.Get("Bets", "Summary").FindSubStatistic(HoldemHand.Rating.Nothing.ToString());
            StatisticsData nothingRaises      = stats.Get("Raises", "Summary").FindSubStatistic(HoldemHand.Rating.Nothing.ToString());
            StatisticsData nothingCheckRaises = stats.Get("Check Raise", "Summary").FindSubStatistic(HoldemHand.Rating.Nothing.ToString());

            float valueSums = nothingBets.Value +
                              nothingRaises.Value +
                              nothingCheckRaises.Value;

            // To compute an average, we first have to see if the values are known (or are set to zero just because they are unknown)
            float divideBy = 0;

            if (!(nothingBets is StatisticsUnknownData))
            {
                divideBy += 1.0f;
            }
            if (!(nothingRaises is StatisticsUnknownData))
            {
                divideBy += 1.0f;
            }
            if (!(nothingCheckRaises is StatisticsUnknownData))
            {
                divideBy += 1.0f;
            }
            bool noInformation = (divideBy == 0);

            float valueAverage;

            if (noInformation)
            {
                valueAverage = 0;
            }
            else
            {
                valueAverage = valueSums / divideBy;
            }

            picDonkPlayer.Visible = (valueAverage >= 0.1) || noInformation;
            picDonkPlayer.SetQuestionSignVisible(noInformation);
        }
Пример #4
0
        public void DisplayIcons(PlayerStatistics stats)
        {
            StatisticsData calls     = stats.Get("Calls", "Summary").MainData;
            StatisticsData checkCall = stats.Get("Check Call", "Summary").MainData;

            // If calls are > 40% or check calls are more than 66% then calling station!
            picCallingStation.Visible = (calls.Value >= 0.40 || checkCall.Value >= 0.66) || (calls is StatisticsUnknownData && checkCall is StatisticsUnknownData);
            picCallingStation.SetQuestionSignVisible(calls is StatisticsUnknownData && checkCall is StatisticsUnknownData);

            StatisticsData foldSbToRaise = stats.Get("Fold Small Blind to a Raise", "Preflop").MainData;
            StatisticsData foldBbToRaise = stats.Get("Fold Big Blind to a Raise", "Preflop").MainData;

            // If average of fold big blind to a raise and fold small blind to a raise > 80% then easy steal
            StatisticsData foldBlindAverage = foldSbToRaise.Average("Fold Small/Big Blind to a Raise", 2, foldBbToRaise);

            picEasySteal.Visible = (foldBlindAverage.Value >= 0.80) || (foldBlindAverage is StatisticsUnknownData);
            picEasySteal.SetQuestionSignVisible(foldBlindAverage is StatisticsUnknownData);

            // If a person raises more than 50% of his buttons, chances are he might be stealing
            StatisticsData stealRaises = stats.Get("Steal Raises", "Preflop").MainData;

            picButtonStealer.Visible = (stealRaises.Value >= 0.5) || (stealRaises is StatisticsUnknownData);
            picButtonStealer.SetQuestionSignVisible(stealRaises is StatisticsUnknownData);

            toggleIsSolidIcon(stats);

            toggleIsDonkIcon(stats);

            /*
             * picCallingStation.Visible = true;
             * picCallingStation.SetQuestionSignVisible(false);
             * picEasySteal.Visible = true;
             * picEasySteal.SetQuestionSignVisible(false);
             * picButtonStealer.Visible = true;
             * picButtonStealer.SetQuestionSignVisible(false);
             * picSolidPlayer.Visible = true;
             * picSolidPlayer.SetQuestionSignVisible(false);
             * picDonkPlayer.Visible = true;
             * picDonkPlayer.SetQuestionSignVisible(false);
             */
        }
Пример #5
0
        public override StatisticsData Average(String name, int precision, params StatisticsData[] stats)
        {
            Trace.Assert(stats.Length > 0, "Cannot compute the average of zero elements.");

            // Make sure that the stats we have at least one non-unknown value (otherwise this method will cause an
            // infinite loop
            bool allUnknown = true;

            for (int j = 0; j < stats.Length; j++)
            {
                if (!(stats[j] is StatisticsUnknownData))
                {
                    allUnknown = false;
                    break;
                }
            }

            if (allUnknown)
            {
                return(new StatisticsUnknownData(name));
            }
            else
            {
                // This statistics does not know its value, so we take the first element in the other statistics
                // And calculate the average through them

                StatisticsData[] newParams = new StatisticsData[stats.Length];
                int i;
                for (i = 0; i < stats.Length - 1; i++)
                {
                    newParams[i] = stats[i + 1];
                }
                newParams[i] = this;

                return(stats[0].Average(name, precision, newParams));
            }
        }
Пример #6
0
 // Wrap around
 public StatisticItem(StatisticsData statisticToDispay, Control parent)
     : this(new Statistic(statisticToDispay, ""), parent)
 {
 }
Пример #7
0
        public Statistic Average(String category, int precision, params Statistic[] stats)
        {
            int paramsCount = stats.Count<Statistic>();

            // Populate param list for main data
            StatisticsData[] mainStats = new StatisticsData[paramsCount];
            for (int i = 0; i < paramsCount; i++)
            {
                mainStats[i] = stats[i].MainData;
            }

            // Compute average for main data
            StatisticsData mainDataAverage = MainData.Average(MainData.Name, precision, mainStats);

            // Assume the sub statistics are ordered and are of the same size of the other sub statistics
            List<StatisticsData> subDataAverages = new List<StatisticsData>();
            for (int i = 0; i < SubData.Count; i++)
            {
                // Populate a param list with the values for each sub value
                StatisticsData[] subStats = new StatisticsData[paramsCount];
                for (int j = 0; j < paramsCount; j++)
                {
                    Trace.Assert(SubData.Count == stats[j].SubData.Count, "Trying to compute the average of sub statistics values when their sizes are different.");
                    subStats[j] = stats[j].SubData[i];
                }

                subDataAverages.Add(SubData[i].Average(SubData[i].Name, precision, subStats));
            }

            return new Statistic(mainDataAverage, category, subDataAverages);
        }
Пример #8
0
 public void AddSubStatistic(StatisticsData subStatistic)
 {
     subData.Add(subStatistic);
 }
Пример #9
0
 public Statistic(StatisticsData mainData, String category, List<StatisticsData> subData)
     : this(mainData, category)
 {
     this.subData = subData;
 }
Пример #10
0
 public Statistic(StatisticsData mainData)
     : this(mainData, "")
 {
 }
Пример #11
0
 public void AddSubStatistic(StatisticsData subStatistic)
 {
     subData.Add(subStatistic);
 }
Пример #12
0
 public Statistic(StatisticsData mainData, String category, List <StatisticsData> subData)
     : this(mainData, category)
 {
     this.subData = subData;
 }
Пример #13
0
 public Statistic(StatisticsData mainData)
     : this(mainData, "")
 {
 }
Пример #14
0
 // Wrap around
 public StatisticItem(StatisticsData statisticToDispay, Control parent)
     : this(new Statistic(statisticToDispay, ""), parent)
 {
 }