Ejemplo n.º 1
0
        public Event(string name, string venue, string hill, DateTime date, EventParameters parameters, IList <EventCompetitor> competitors)
        {
            _name        = name;
            _venue       = venue;
            _hill        = hill;
            _date        = date;
            _parameters  = parameters;
            _competitors = competitors;
            _rounds      = new List <EventRound>();

            //Alternative implementation would be to just initialize an empty list
            //Application would then Add results to the list
            //Now application shall Update results in the list
            _results = new List <EventResult>();
            foreach (EventCompetitor c in _competitors)
            {
                _results.Add(new EventResult(c, 0));
            }
        }
Ejemplo n.º 2
0
        public void ScoreJump(JumpData data, EventParameters parameters)
        {
            //Set jump data
            _jumpData = data;

            //Calculate and set jump score
            double score = 0;

            //Length
            //points = basepoints + (length-kpoint)*metervalue
            score += parameters.BasePoints + (data.JumpLength - parameters.KPoint) * parameters.MeterValue;

            //Wind correction (+/-)
            //length correction = (wind correction)*(kpoint-36)/20, rounded to nearest 0,5 meters
            //!!!
            //Exact rounding rule should be double checked!
            //!!!
            //points = (length correction)*metervalue
            double lengthCorrectionWind = data.WindCorrection * (parameters.KPoint - 36) / 20;

            lengthCorrectionWind = Math.Round(lengthCorrectionWind * 2, MidpointRounding.AwayFromZero) / 2;
            score += lengthCorrectionWind * parameters.MeterValue;

            //Platform correction (+/-)
            //length correction = (platform correction)*(platform correction factor)
            //points = (length correction)*metervalue
            double lengthCorrectionPlatform = data.PlatformCorrection * parameters.PlatformCorrectionFactor;

            score += lengthCorrectionPlatform * parameters.MeterValue;

            //Style points
            //5 judges, 5 style points between 0-20, min and max values are removed
            //points = sum(remaining 3 styles)
            IList <double> usedStylePoints = data.StylePoints.OrderBy(sp => sp).Skip(1).Take(3).ToList();

            score     += usedStylePoints.Sum();
            _jumpScore = score;

            //Note negative points for a jump are possible by the scoring algorithm and are allowed by the implementation!
        }