-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cs
55 lines (49 loc) · 1.13 KB
/
Player.cs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.Generic;
namespace pulse
{
/// <summary>
/// Player class.
/// </summary>
public class Player
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>
/// The name.
/// </value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the point metrics.
/// </summary>
/// <value>
/// The point metrics.
/// </value>
public IDictionary<string, double> PointMetrics { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Player"/> class.
/// </summary>
public Player(string name)
{
this.Name = name;
this.PointMetrics = Points.EmptyDefaultValues();
}
/// <summary>
/// Scores the specified point values.
/// </summary>
/// <param name="pointValues">The point values.</param>
/// <returns>The score with the given values per metric.</returns>
public double Score(IDictionary<string, double> pointValues)
{
var score = 0.0;
foreach (var metric in this.PointMetrics)
{
if (pointValues.ContainsKey(metric.Key))
{
score += metric.Value * pointValues[metric.Key];
}
}
return score;
}
}
}