using System.Collections.Generic; namespace pulse { /// /// Player class. /// public class Player { /// /// Gets or sets the name. /// /// /// The name. /// public string Name { get; set; } /// /// Gets or sets the point metrics. /// /// /// The point metrics. /// public IDictionary PointMetrics { get; set; } /// /// Initializes a new instance of the class. /// public Player(string name) { this.Name = name; this.PointMetrics = Points.EmptyDefaultValues(); } /// /// Scores the specified point values. /// /// The point values. /// The score with the given values per metric. public double Score(IDictionary pointValues) { var score = 0.0; foreach (var metric in this.PointMetrics) { if (pointValues.ContainsKey(metric.Key)) { score += metric.Value * pointValues[metric.Key]; } } return score; } } }