Ejemplo n.º 1
0
        public HandValueGradeEnum GradeAHand(StartingHand startingHand)
        {
            var percentile = StartingHandEvs.GetPercentila(startingHand.Name);

            if (percentile <= _percentiles.AllInPercentile)
            {
                return(HandValueGradeEnum.AllIn);
            }

            if (percentile <= _percentiles.ValuePercentile)
            {
                return(HandValueGradeEnum.BetForValue);
            }

            if (percentile <= _percentiles.FlatPercentile)
            {
                return(HandValueGradeEnum.Flat);
            }

            if (percentile <= _percentiles.BluffPercentile)
            {
                return(HandValueGradeEnum.BetForBluff);
            }

            return(HandValueGradeEnum.Fold);
        }
Ejemplo n.º 2
0
 public bool Equals(Player player)
 {
     return(IsDealer == player.IsDealer &&
            IsSmallBlind == player.IsSmallBlind &&
            IsBigBlind == player.IsBigBlind &&
            PlayerId == player.PlayerId &&
            PlayerName == player.PlayerName &&
            Chips == player.Chips &&
            (StartingHand != null && StartingHand.Equals(player.StartingHand)) &&
            (CurrentHand != null && CurrentHand.Equals(player.CurrentHand)) &&
            CallSum == player.CallSum &&
            CalledSum == player.CalledSum &&
            Folded == player.Folded &&
            Checked == player.Checked);
 }
Ejemplo n.º 3
0
        public void CalculateKnwonStartingHands()
        {
            Counts     = new ConcurrentDictionary <StartingHand, double>();
            TotalCount = 0;
            foreach (StartingHand hand in StartingHand.AllStartingHands.Values)
            {
                Counts.TryAdd(hand, 0);
            }

            foreach (HandHistory hand in View.Find(new BsonDocument()).ToEnumerable())
            {
                //HandHistory hand = view.Find(h => h.HandId.Equals(handidObj.HandId)).First();
                if (hand.HandActions.FindAll(h => h.IsPreFlopRaise).Sum(h => h.Amount) < RaiseMultiplier + 1)
                {
                    foreach (Player player in hand.Players)
                    {
                        if (player.IsSittingOut)
                        {
                            continue;
                        }
                        if (!player.Equals(hand.Hero) && player.hasHoleCards)
                        {
                            StartingHand startingHand = StartingHand.FindStartingHand(player.HoleCards);
                            Counts[startingHand] += 1 / (double)startingHand.Count;
                            ++TotalCount;
                        }
                    }

                    if (TotalCount % Settings.Default.RangeUpdateInterval == 0)
                    {
                        ReportProgress(10);
                    }

                    if (CancellationPending)
                    {
                        break;
                    }
                }
            }

            ReportProgress(10);
            //Console.Write(string.Format("{0} showdown actions found", handsFound));
        }
Ejemplo n.º 4
0
        private void rangeListener(Object sender, EventArgs e)
        {
            RangeWorker worker = (RangeWorker)sender;
            Dictionary <StartingHand, double> values = new Dictionary <StartingHand, double>(worker.Counts);
            long count = worker.TotalCount;

            double average = values.Values.Average();
            double stdDev  = values.StdDev();

            foreach (Label label in rangeLabels)
            {
                StartingHand hand = StartingHand.AllStartingHands[label.Text];
                if (values.ContainsKey(hand))
                {
                    double deviations = (values[hand] - average) / stdDev;
                    Color  colour     = Color.Transparent;
                    if (deviations > 2)
                    {
                        colour = Color.Yellow;
                    }
                    else if (deviations > 1)
                    {
                        colour = Color.LightGreen;
                    }
                    else if (deviations > 0)
                    {
                        colour = Color.YellowGreen;
                    }

                    label.Invoke((MethodInvoker)(() =>
                    {
                        label.BackColor = colour;
                    }));
                }
            }

            RangeHandCountLabel.Invoke((MethodInvoker)(() => RangeHandCountLabel.Text = string.Format("Based on {0} hands", count)));
        }
Ejemplo n.º 5
0
        public Decision MakeDecision(PreflopStatusSummary statusSummary, StartingHand startingHand)
        {
            var handGrade = _handRangeConsultant.GenerateHandGrader(statusSummary).GradeAHand(startingHand);

            return(GenerateDecisionFromHandGrade(handGrade, statusSummary));
        }