Esempio n. 1
0
        public static void StartDay1(Random r, StartNode n, List<Team> teams, DateTime start)
        {
            if (n == null)
                throw new CPException("Не задан стартовый этап второго дня (Старт2)");

            List<Team> a = teams.Where(t => t.Grade >= 2)
                                .OrderBy(t => r.Next())			// shuffle!
                                .ToList();
            List<Team> b = teams.Where(t => t.Grade < 2)
                                .OrderBy(t => r.Next())
                                .ToList();

            int i = 0;
            int channels = n.Channels > 0 ? n.Channels : 1;
            foreach (var t in JoinLists(a, b))
            {
                n.AddTeam(r, t, start);
                t.SetStart(start);

                i++;
                if (i % channels == 0)
                    start += n.Times.Max;
            }
        }
Esempio n. 2
0
        public static void StartDay2(Random r, StartNode n, List<Team> teams, DateTime start, bool smart)
        {
            if (n == null)
                throw new CPException("Не задан стартовый этап второго дня (Старт2)");

            int APlus = 2;
            List<Team> a = teams.Where(t => t.Grade >= APlus)
                                .OrderBy(t => t.GetStat(0).Work.TotalSeconds)
                                .ToList();
            List<Team> b = teams.Where(t => t.Grade < APlus)
                                .OrderBy(t => t.GetStat(0).Work.TotalSeconds)
                                .ToList();

            int i = 0;
            int channels = n.Channels > 0 ? n.Channels : 1;
            foreach (var t in JoinLists(a, b))
            {
                n.AddTeam(r, t, start);
                t.SetStart(start);

                i++;
                start = Start(smart, start, i, channels, n.Times.Max);
            }
        }
Esempio n. 3
0
        public static void AddTeam(Random r, StartNode n, List<Team> teams, DateTime t)
        {
            var team = teams.First();
            n.AddTeam(r, team, t);
            teams.RemoveAt(0);

            team.SetStart(t);
        }