Menu

#19 Penalty application does not account for running out of fuel

None
closed
None
1
2026-06-14
2025-07-25
David Bears
No

I finished a race today with some surprising results. I ran out of fuel on the last lap, so I finished with a time of "+1 lap", but the final ranking puts me ahead of other drivers that finished all laps.

A brief look at the source brought me to this comment:

All time penalties are added up and then applied to the ranking like this:
We "pump up" the result of the opponents with less laps up to our laps
with a simple linear model: opponent_race_time/opponent_laps*our_race_laps, so
we are worse when:
our_race_time + our_penalty_time >
opponent_race_time/opponent_laps*our_race_laps + opponent_penalty_time

So it seems drivers with non-zero penalty are ranked based on average lap time -- not race completion and total time as would be expected. Thus, a driver could theoretically win the race by making a few fast laps and then intentionally running out of fuel. Such a driver would have a fast average lap time and thus beat any other driver that accrued any penalty despite finishing only a few laps.

Instead, I propose assessing full-lap penalties based on the penalty amount plus the time between the leader crossing the finish line and the penalized driver crossing the line. This sum, divided by the penalized driver's lap time (best or average, idk which) is the number of additional penalty laps that are assessed. The sum modulo the penalized driver's lap time plus the leader's total time is the penalized total time. This effectively tries to approximate how many fewer laps the penalized driver would have completed and what his total time would be had he actually served the penalty. That is:

penalized_laps = total_laps - (total_time - leader_time + penalty_time) / lap_time
penalized_time = leader_time + (total_time - leader_time + penalty_time) % lap_time

Then ranking can be ordered first on penalized_laps (higher is better) and then penalized_time (lower is better).

A DNF is ranked as if penalized_laps = total_laps and penalized_time = infinity. Multiple drivers with DNF on the same lap can be ranked according to how far they got in the lap.

This approach has the distinct advantage that all penalties can be fully assessed before sorting. (Penalties need not be re-computed on each sorting comparison.) It also, of course, fixes the issue of DNF being ranked ahead of drivers that complete more laps.

1 Attachments

Discussion

  • Bernhard Wymann

    Bernhard Wymann - 2025-08-04

    Interesting, I will have a look when I rework this. The code was more of an experiment to discourage driving around with pending penalties, but I guess it is too confusing, I might revert this to something closer to the original.

     
  • Bernhard Wymann

    Bernhard Wymann - 2026-04-13
    • assigned_to: Bernhard Wymann
    • Group: -->
     
  • Bernhard Wymann

    Bernhard Wymann - 2026-04-13

    Target 1.3.10

     
  • Bernhard Wymann

    Bernhard Wymann - 2026-06-14
    • status: open --> closed
     

Log in to post a comment.