Beispiel #1
0
        private List <Fight> ScheduleFights(WeightClass wc)
        {
            List <Fighter> fighters = Fighters.AllFighters().Where(fighter => fighter.Weight == wc.Weight).ToList();
            List <Fight>   schedule = new List <Fight>();

            //Sort in reverse order
            fighters.Sort((f1, f2) => Rating.Rating(f2).CompareTo(Rating.Rating(f1)));

            while (fighters.Count > 1)
            {
                int f1 = 0, f2 = 1;
                for (; f2 < fighters.Count - 1; ++f2)
                {
                    if (MathUtils.RangeUniform(0, 1) < 0.05)
                    {
                        break;
                    }
                }

                var judges = Agents.RandomBunch(PersonType.JUDGE, 3).Select(j => (Judge)j).ToArray();
                schedule.Add(new Fight(fighters[f1], fighters[f2], 12, judges));
                fighters.RemoveAt(f1); fighters.RemoveAt(f2 - 1);
            }

            return(schedule);
        }
Beispiel #2
0
        public string Status(int top = -1)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (top == -1)
            {
                top = Fighters.Count();
            }

            List <Fighter> fighters = Fighters.AllFighters();

            fighters.Sort((f1, f2) => Rating.Rating(f1).CompareTo(Rating.Rating(f2)));

            for (int f = 0; f < top; ++f)
            {
                Fighter curr = fighters[f];
                sb.AppendFormat($"{f + 1}. {curr.Name}\n\t{curr.Record} Rating: {Rating.Rating(curr)}\n");
                sb.AppendFormat($"\tSkill Level: {curr.OverallSkill()} Weight: {curr.Weight}");
                //sb.AppendLine();
                // sb.AppendLine(curr.ToString());
                sb.AppendLine();
            }

            return(sb.ToString());
        }