Ejemplo n.º 1
0
        public void LoadRange(string viewName, bool implied = true)
        {
            foreach (Label label in rangeLabels)
            {
                label.BackColor = Color.Transparent;
            }

            if (RangeThread != null && RangeThread.IsBusy)
            {
                RangeThread.CancelAsync();
            }

            RangeThread = new RangeWorker(viewName, -PreFlopBetSize.Value, implied);
            RangeThread.ProgressChanged += rangeListener;
            RangeThread.RunWorkerAsync();
        }
Ejemplo n.º 2
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)));
        }