Пример #1
0
        public static void Rank(RatingScope scope, IRatingTarget targetScore, RatingMethod method)
        {
            //int t1 = Environment.TickCount;

            List <Student> students = scope.GetContainTargetList(targetScore);

            //按成績高低排序。
            students.Sort(new ScoreComparer(targetScore));

            //實際有包含成績的人數。
            int actualBase = students.Count;

            //所有被排名的人數。
            int baseCount = scope.Count;

            //名次決定演算法。
            IRatingAlgorithm placeDecision = GetAlgorithm(method);

            foreach (Student eachStudent in students)
            {
                //決定名次
                int place = placeDecision.NextPlace(targetScore.GetScore(eachStudent));

                //寫入名次資訊。
                targetScore.SetPlace(eachStudent, new ResultPlace(scope, targetScore, baseCount, actualBase, place));
            }

            //string msg = "排名時間:{0} 範圍名稱:{1} 成績名稱:{2}";
            //Console.WriteLine(msg, Environment.TickCount - t1, scope.Name, targetScore.Name);
        }
Пример #2
0
 public void Rank(RatingMethod method)
 {
     foreach (IRatingTarget each in RatingTargets)
     {
         RatingUtility.Rank(this, each, method);
     }
 }
Пример #3
0
        public double ComputeRating(int numberOfRounds, PlayerRatingData playerData, RatingMethod method)
        {
            switch (method)
            {
            case RatingMethod.HLTV_ORG: return(ComputeRating(numberOfRounds, playerData));

            case RatingMethod.CSGO: throw new NotImplementedException();                     // TODO (score in csgo scoreboard)

            case RatingMethod.BuRner: throw new NotImplementedException();                   //TODO (assists, clutch)

            default: throw new ArgumentException();
            }
        }
Пример #4
0
 private static string GetRatingOption(RatingMethod ratingMethod)
 {
     if (ratingMethod == RatingMethod.Sequence)
     {
         return("接序排名");
     }
     else if (ratingMethod == RatingMethod.Unsequence)
     {
         return("不接序排名");
     }
     else
     {
         throw new ArgumentException("沒有此種排名選項。");
     }
 }
Пример #5
0
        private static IRatingAlgorithm GetAlgorithm(RatingMethod method)
        {
            IRatingAlgorithm placeDecision;

            if (method == RatingMethod.Sequence)
            {
                placeDecision = new SequenceAlgorithm();
            }
            else
            {
                placeDecision = new UnSequenceAlgorithm();
            }

            return(placeDecision);
        }