import type { Pt } from "./crowd.ts"; import type { CircuitRace, RaceCar } from "./circuits.race.ts"; /** What a car is doing. */ export type RaceStatus = "grid" | "running" | "pit" | "out" | "finished"; /** One line of the timing board. */ export interface RaceStanding { car: RaceCar; /** Its place in the race's `cars`. */ index: number; /** 1 for the leader. */ position: number; status: RaceStatus; /** Laps done. */ laps: number; /** Seconds behind the leader (undefined for the leader, and for a car a lap or more down), and laps down. */ gap?: number; lapsDown: number; /** The same to the car in front. */ interval?: number; intervalLaps: number; /** The last lap's time and the car's best, in seconds. */ last?: number; best?: number; /** Pit stops made. */ stops: number; /** Where it is on the drawing, in its frame (feet), and its race distance in metres. */ at: Pt; distance: number; } /** A moment of the race. */ export interface RaceMoment { /** Seconds since the start. */ t: number; /** The lap the leader is on (1 to `laps`), and the laps of the race. */ lap: number; laps: number; /** Whether the chequered flag has fallen, and whether the race is over (every car home). */ flag: boolean; over: boolean; /** The standings, leader first. */ standings: RaceStanding[]; /** The fastest lap so far: the car's place in `cars`, the lap and its time. */ fastest?: { index: number; lap: number; time: number; }; } /** A car's race distance at a time (metres from the timing line), and its distance along the pit lane, or NaN on the track. */ export declare function carAt(race: CircuitRace, index: number, t: number): { distance: number; pit: number; }; /** Where a car is on the drawing at a time, in the drawing's frame (feet): on the lap, or in the pit lane. */ export declare function racePoint(race: CircuitRace, index: number, t: number): Pt; /** * A moment of a race: each car's place on the drawing and its line of the timing board (position, laps, the gap to the leader and to the car in front, the last and best laps, the stops), the lap the leader is on and * the fastest lap so far. * @example * ```ts * import { raceAt, simulateRace } from "@johnmorrisdotca/kyogijo-stadiums/circuits"; * const race = simulateRace({ circuit: "las-vegas", laps: 3, cars: 4 }); * const now = raceAt(race, 150); * console.log(now.lap, now.standings.length, now.standings[0].position, now.flag); * // 2 4 1 false * ``` */ export declare function raceAt(race: CircuitRace, time: number): RaceMoment;