Exemple #1
0
        private int actualSimulation;       // zmiena przechowujaca ilosc aktualnej symulacji

        // metoda liczaca eq
        private void Calc(object a)
        {
            int    n    = Convert.ToInt32(a);
            double win1 = 0;
            double win2 = 0;
            double spl  = 0;

            for (int i = 0; i < n; i++)
            {
                Hand h1 = new Hand(c[0], new Board(d.GetCard(0), d.GetCard(1), d.GetCard(2), d.GetCard(3), d.GetCard(4)));
                Hand h2 = new Hand(c[1], new Board(d.GetCard(0), d.GetCard(1), d.GetCard(2), d.GetCard(3), d.GetCard(4)));

                switch (h1.CompareTo(h2))
                {
                case 0:
                    win1 += 0.5;
                    win2 += 0.5;
                    spl++;
                    break;

                case 1:
                    win1++;
                    break;

                case -1:
                    win2++;
                    break;
                }
                h1Win            = win1 / i;
                h2Win            = win2 / i;
                split            = spl / i;
                actualSimulation = i + 1;;
                d.ReShuffle(5);
            }
        }