Example #1
0
        public void UpdateEquityData()
        {
            var ranges = Ranges?.OfType <EquityRangeSelectorItemViewModel>().ToArray();

            var totalCombos     = 0;
            var foldCheckCombos = 0;
            var callCombos      = 0;
            var bluffCombos     = 0;
            var valueBetCombos  = 0;

            if (ranges.Length != 0)
            {
                foreach (var range in ranges)
                {
                    foldCheckCombos += range.FoldCheckCombos;
                    callCombos      += range.CallCombos;
                    bluffCombos     += range.BluffCombos;
                    valueBetCombos  += range.ValueBetCombos;
                    totalCombos     += range.Combos;
                }
            }
            // known cards are equal to 1 combo
            else if (Cards.All(x => x.Validate()))
            {
                totalCombos = 1;
            }

            TotalCombos     = totalCombos;
            FoldCheckCombos = foldCheckCombos;
            CallCombos      = callCombos;
            BluffCombos     = bluffCombos;
            ValueBetCombos  = valueBetCombos;

            IsTotalCombosVisible = FoldCheckCombos == CallCombos &&
                                   CallCombos == BluffCombos && BluffCombos == ValueBetCombos && ValueBetCombos == 0;

            FoldCheckPercentage = GetEquityRangePercentage(foldCheckCombos, totalCombos);
            CallPercentage      = GetEquityRangePercentage(callCombos, totalCombos);
            BluffPercentage     = GetEquityRangePercentage(bluffCombos, totalCombos);
            ValueBetPercentage  = GetEquityRangePercentage(valueBetCombos, totalCombos);
        }