FA-68057 / Traffic signal timing plans / Member archive
Shortway offset transition: the offset error is computed current minus target · case 02
Shortway offset transition returns a wrong result when the offset error is computed current minus target.
Case contract
Input {cycle, current_offset, target_offset, lengthen_pct, shorten_pct}. The needed correction e = (target - current) mod cycle can be made by lengthening cycles by a total of e or shortening them by cycle - e. Per-cycle limits are floor(cycle*pct/100). Choose the direction needing fewer cycles (ties lengthen) and front-load the maximum adjustment each cycle. Return the list of transition cycle lengths ([] when already in step).
Why this case matters
Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| timing oracle 0 | [140, 140, 140, 130] | [140, 140, 130] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗