strategy.py
Output
Build your setup, press Test run, and compare your car against the AI grid.
Build your setup, press Test run, and compare your car against the AI grid.
| Setting | Range | Effect |
|---|---|---|
car_number | 1 - 99 | Your car number (shown on the dot) |
number_color | hex colour | Colour of the number on your dot |
front_downforce | 0.1 - 1.0 | More = faster corners, slower straights |
rear_downforce | 0.1 - 1.0 | More = better traction, more drag |
fuel_load | 30 - 100 kg | More = heavier (slower) but lasts longer. Run out = crawling! |
gear_ratio | 0.0 - 1.0 | 0 = better acceleration but lower top speed, 1 = higher top speed but slower acceleration |
tyre_compound | "soft" / "medium" / "hard" | Soft = most grip and most forgiving, Hard = least grip but longest life |
Your driver runs at each straight or corner in races, and once in qualifying. Use lap_number for decisions that should change once per lap.
| Return Value | Range | Effect |
|---|---|---|
aggression_braking | 0.0 - 1.0 | Higher = brake later (faster but risk lock-ups!) |
temperament | "cautious", "balanced", "aggressive" | Optional: changes pace, tyre wear and incident risk. Defaults to balanced. |
aggression_cornering | 0.0 - 1.0 | Higher = faster corners (more tyre wear, risk spins!) |
aggression_acceleration | 0.0 - 1.0 | Higher = more throttle (faster but burns more fuel) |
overtake_mode | "push" / "defend" / "cautious" | Push = best for attacking, Defend = harder to pass but weaker on attack, Cautious = minimal risk |
battery_mode | "save" / "balanced" / "deploy" | Save = -3% straight speed and +12% battery per lap; balanced = normal speed and -3% per lap; deploy = +3% straight speed while charged and -15% per lap |
info you can use| Key | What it tells you |
|---|---|
info["tyre_wear"] | 0-100%, higher = less grip |
info["fuel_remaining"] | kg of fuel left |
info["battery"] | 0-100% battery charge |
info.get("segment_type", "straight") | Current straight or corner in races |
info.get("segment_number", 1) | Current segment, starting at 1 |
info.get("lap_progress", 0) | Fraction of current lap completed (0–1) |
info["lap_number"] | Current lap number |
info["total_laps"] | Total laps in race |
info["position"] | Your current race position |
info["gap_ahead"] | Estimated seconds to car in front |
info["gap_behind"] | Estimated seconds to car behind |
info["weather"] | "dry", "damp", or "wet" |