Ejemplo n.º 1
0
        public static double[,] colors_AvarageRatio(Urn u, int steps, int iterations, BackgroundWorker b)
        {
            double[,] result = new double[iterations, u.totalcolorsnumber];
            int valor_pos = u.getTotalColorsNumber();

            for (int i = 0; i < iterations; i++)
            {
                u.simulation(steps);
                for (int color = 0; color < valor_pos; color++)
                {
                    result[i, color] = u.getProportionOfBall(color);
                }


                u.reset();
                b.ReportProgress((i + 1 * 100) / iterations);
            }


            return(result);
        }
Ejemplo n.º 2
0
        public void printColorRunChart(BackgroundWorker b)
        {
            if (!int.TryParse(this.tb_Steps.Text, out this.steps))
            {
                MessageBox.Show("Please insert a valid value to the steps box");
                b.CancelAsync();
                return;
            }
            UrnPolya.Urn a = this.selected_urn_process();
            if (a == null)
            {
                return;
            }
            a.simulation(steps, this.backgroundWorker2);
            if (a == null)
            {
                return;
            }
            double[,] result = a.getProportions();

            F_grafico f_grafico = new F_grafico(result, this.ColorsUsedList, steps + 1);

            f_grafico.ShowDialog();
        }