Dynamic Rating System (DRS)
            DRS is an ELO-inspired rating engine for motorsports racing. It measures how far a driver exceeds or falls short of expectations in every race â not just who wins, but how much better (or worse) they did than their car, form, and rivals suggest they should have.
            1. Expected Performance
            For every driver in the race, we calculate their expected win probability against every other driver using the classic ELO formula:
            Expected = 1 / (1 + 10(OpponentElo - MyElo)/400)
            Then average all those expected scores â this is what the driver âshouldâ have achieved based purely on current skill rating.
            
                In Simple Terms:  
                âIf Max has 2000 Elo and Zhou has 1400, Max is expected to beat Zhou ~91% of the time. We do this for every pair in the race and average it. Thatâs the bar the driver has to clear.â
            
            2. Actual Performance
            Turns finishing position into a 0â1 score:
            
                Normalized = (total drivers - position) / (total - 1) â P1 = 1.0, last = 0.0 
                Score = Normalized^1.2 (slightly rewards higher finishes more) 
                - Points bonus: P1âP10 get up to +0.3 extra
 
                - Teammate beat: +0.10 (backmarker teams get +0.05 extra)
 
                - Finish multiplier: Ã1.05 for finishing
 
                - DNF: 0.1 + (laps completed / 60) Ã 0.3 Ã team reliability factor
 
            
            
                In Simple Terms:  
                âP1 isnât just â1stâ, itâs a near-perfect score. Beating your teammate? Extra credit. Crashing out on lap 1? Barely any points. Finishing lap 50 of 60? You get partial credit â not zero.â
            
            3. Performance Difference
            Diff = Actual Score â Expected Score
            Positive = outperformed expectations. Negative = underperformed.
            
                In Simple Terms:  
                âDid the driver do better than their rating said they would? Thatâs the gap we care about.â
            
            4. Dynamic K-Factor (Learning Rate)
            Base = 28. Then adjusted:
            
                - High Elo (>1900) â Ã0.7 (slow learning)
 
                - Low Elo (<1400) â Ã1.4 (fast learning)
 
                - Podium â Ã1.4 | P4âP10 â Ã1.2 | Back of grid â Ã1.1
 
                - Smaller field â lower K | Tighter competition â higher K
 
            
            Final K clamped between 15 and 45.
            
                In Simple Terms:  
                âRookies and backmarkers change rating faster. A podium in a chaotic race? Big swing. A veteran cruising to P8? Small tweak.â
            
            5. Modifiers
            
                - Race Weight (1.0â1.5): Bigger fields, closer Elo spread, more top drivers â more important race â bigger Elo swings.
 
                - Reliability Factor: DNF â ~0.7â0.9 (less penalty if car is unreliable or many laps done). Finish â Ã1.03.
 
                - Team Expectation: Did you beat your teamâs average? Sigmoid curve gives 0.6â1.4Ã boost/penalty.
 
            
            
                In Simple Terms:  
                âA DNF in a fragile car hurts less. Beating your teammate when both cars are slow? Thatâs huge. Crashing a bulletproof Red Bull? Ouch.â
            
            6. Intelligent Capping
            
                - Standard: Âą25 Elo
 
                - Backmarker upside â up to +30, downside only -15
 
                - DNF â no positive gain
 
                - Exceptional: (e.g. backmarker in P4) â up to +40
 
                - Catastrophic: (e.g. 1950 Elo driver P17) â down to -30
 
            
            
                In Simple Terms:  
                âNo one jumps +100 for one miracle. But a Haas in the points? Thatâs worth celebrating. A Ferrari in the wall? That stings â but not endlessly.â
            
            Full Calculation Flow (per driver)
            
                - Build team strength (current + 60% historical)
 
                - Expected = average win-probability vs all others
 
                - Actual = position â score + bonuses
 
                - Diff = Actual â Expected
 
                - Raw Change = K Ã Diff
 
                - Apply: Race Weight à Reliability à Team Expectation
 
                - Cap intelligently â Final Elo change
 
            
            
                In Simple Terms:  
                âItâs not just âyou finished P5â. Itâs: âYou were expected to be P12 in that car. You beat your teammate. The car usually breaks. You finished. Hereâs +32 Elo.ââ
            
            Examples
            
                Exceptional: Backmarker P4
                Expected: 0.15 â Actual: 0.78 â Diff: +0.63 â K: 38 â Raw: +24 â Exceptional cap â +38 Elo
             
            
                Catastrophic: Top driver P17
                Expected: 0.82 â Actual: 0.12 â Diff: -0.70 â K: 22 â Raw: -15 â Catastrophic â -28 Elo
             
            
                DNF with 42/66 laps
                Actual: ~0.29 â Expected: 0.55 â Diff: -0.26 â K: 30 â Reliability: 0.84 â Final: -6 Elo
             
            The Idea: Reward drivers for punching above their weight. Penalize underperformance â but fairly, with context. The system learns and self-corrects over time.