예제 #1
0
        private TimeSpan GetTimeAfterWinner()
        {
            // get the winner pilot Id
            var winnerPilot = Race.PositionPilots.GetValueOrDefault(1);

            // get his last lap race
            var winnerLastLapRace = Race.LapRaces.Where(lr => lr.PilotId == winnerPilot.Id).OrderByDescending(lr => lr.Number).First();

            // get the time Event of that lap race
            var timeEventWinner = winnerLastLapRace.TimeEvent;

            // get the las lap race from the current pilot
            var pilotLastLapRace = LapRaces.OrderByDescending(lr => lr.Number).First();

            // get the time Event of the last lap race from the current pilot
            var timeEventPilot = pilotLastLapRace.TimeEvent;

            return(timeEventPilot - timeEventWinner);
        }
예제 #2
0
 private TimeSpan GetTotalRaceTime()
 {
     // The total race time is the sum of all laps time
     return(LapRaces.Select(lr => lr.TimeDuration).Aggregate((sum, time) => sum + time));
 }
예제 #3
0
        private double GetMeanVelocity()
        {
            var velocitySum = LapRaces.Select(lr => lr.MeanVelocity).Sum();

            return(velocitySum / LapRaces.Count);
        }