public override void clearState() { lapTimesWindow = new List<float>(lapTimesWindowSize); lastConsistencyUpdate = 0; lapDeltaToClassLeaderAtLastLap = -1; lastConsistencyMessage = ConsistencyResult.NOT_APPLICABLE; lapIsValid = true; }
private ConsistencyResult checkAgainstPreviousLaps() { Boolean isImproving = true; Boolean isWorsening = true; Boolean isConsistent = true; for (int index = 0; index < lapTimesWindowSize - 1; index++) { // check the lap time was recorded if (lapTimesWindow[index] <= 0) { Console.WriteLine("no data for consistency check"); lastConsistencyMessage = ConsistencyResult.NOT_APPLICABLE; return ConsistencyResult.NOT_APPLICABLE; } if (lapTimesWindow[index] >= lapTimesWindow[index + 1]) { isImproving = false; break; } } for (int index = 0; index < lapTimesWindowSize - 1; index++) { if (lapTimesWindow[index] <= lapTimesWindow[index + 1]) { isWorsening = false; } } for (int index = 0; index < lapTimesWindowSize - 1; index++) { float lastLap = lapTimesWindow[index]; float lastButOneLap = lapTimesWindow[index + 1]; float consistencyRange = (lastButOneLap * consistencyLimit) / 100; if (lastLap > lastButOneLap + consistencyRange || lastLap < lastButOneLap - consistencyRange) { isConsistent = false; } } // todo: untangle this mess.... if (isImproving) { if (lastConsistencyMessage == ConsistencyResult.IMPROVING) { // don't play the same improving message - see if the consistent message might apply if (isConsistent) { lastConsistencyMessage = ConsistencyResult.CONSISTENT; return ConsistencyResult.CONSISTENT; } } else { lastConsistencyMessage = ConsistencyResult.IMPROVING; return ConsistencyResult.IMPROVING; } } if (isWorsening) { if (lastConsistencyMessage == ConsistencyResult.WORSENING) { // don't play the same worsening message - see if the consistent message might apply if (isConsistent) { lastConsistencyMessage = ConsistencyResult.CONSISTENT; return ConsistencyResult.CONSISTENT; } } else { lastConsistencyMessage = ConsistencyResult.WORSENING; return ConsistencyResult.WORSENING; } } if (isConsistent) { lastConsistencyMessage = ConsistencyResult.CONSISTENT; return ConsistencyResult.CONSISTENT; } return ConsistencyResult.NOT_APPLICABLE; }
public override void clearState() { lapTimesWindow = new List<float>(lapTimesWindowSize); lastConsistencyUpdate = 0; lastConsistencyMessage = ConsistencyResult.NOT_APPLICABLE; lapIsValid = true; lastLapRating = LastLapRating.NO_DATA; deltaPlayerBestToSessionBestInClass = TimeSpan.MaxValue; deltaPlayerBestToSessionBestOverall = TimeSpan.MaxValue; deltaPlayerLastToSessionBestInClass = TimeSpan.MaxValue; deltaPlayerLastToSessionBestOverall = TimeSpan.MaxValue; lastLapTime = 0; bestLapTime = 0; currentPosition = -1; currentGameState = null; isHotLapping = false; lastGapToSecondWhenLeadingPracOrQual = TimeSpan.Zero; }
public override void clearState() { lapTimesWindow = new List<float>(lapTimesWindowSize); lastConsistencyUpdate = 0; lastConsistencyMessage = ConsistencyResult.NOT_APPLICABLE; lapIsValid = true; lastLapRating = LastLapRating.NO_DATA; sessionBestLapTimeDeltaToLeader = TimeSpan.MaxValue; currentLapTimeDeltaToLeadersBest = TimeSpan.MaxValue; lastLapTime = 0; isInSlowerClass = false; currentPosition = -1; }