summaryrefslogtreecommitdiff
path: root/Analizator9000/Analizator9000/MaxScorer.cs
blob: e92f506d7bba20ecc27cb117aa8e1f4730887678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace Analizator9000
{
    /// <summary>
    /// Matchpoint scoring method
    /// </summary>
    class MaxScorer : BaseScorer
    {
        /// <summary>
        /// Scoring method for matchpoints
        /// </summary>
        /// <param name="score1">Score to calculate the outcome</param>
        /// <param name="score2">Score to compare to</param>
        /// <returns>2 matchpoints for a better score, no matchpoints for worse, 1 if scores are the same</returns>
        override protected double getResultFromScores(long score1, long score2)
        {
            return score1 > score2 ? 2.0 : (score1 < score2 ? 0.0 : 1.0);
        }

        /// <summary>
        /// Averaging method for matchpoints
        /// </summary>
        /// <param name="scoreCount">Number of scores in the traveller</param>
        /// <returns>Maximum matchpoint score (2 * (n - 1))</returns>
        protected override double getDivisorFromScoreCount(int scoreCount)
        {
            return 2.0 * (scoreCount - 1);
        }

    }
}