Esempio n. 1
0
        public FightOutcome SimulateFight(int index1, int index2, bool printResult = true, bool sortFighters = false)
        {
            Fighter         f1 = Fighters[index1];
            Fighter         f2 = Fighters[index2];
            Fight           ff = new Fight(f1, f2);
            IFightSimulator fs = new EloFightSimulator();
            FightOutcome    fo = fs.SimulateFight(ff);

            if (printResult && (this.IsTopFighter(index1) || this.IsTopFighter(index2)))
            {
                PrintFightResult(index1, index2, fo);
            }
            if (sortFighters) // sort the pool
            {
                SortFighters();
            }
            return(fo);
        }
Esempio n. 2
0
        public void SimulateFights(int epsilon = 16)
        {
            int             op;
            int             coeff;
            IFightSimulator fs = new EloFightSimulator();

            for (int i = 0; i < Fighters.Count(); i++)
            {
                coeff = (rand.Next(0, 2) > 0) ? 1 : -1;
                op    = i + coeff * rand.Next(1, epsilon);
                if (op < 0)
                {
                    op += epsilon;
                }

                else if (op > Fighters.Count() - 1)
                {
                    op -= epsilon;
                }

                FightOutcome fo = this.SimulateFight(i, op);
            }
            SortFighters();
        }