FA-69311 / Tide and marine navigation tables / Open access
Deviation card interpolation: Interpolation assumes a 45 degree card spacing · case 01
Irregular cards give deviations outside the neighbouring values.
ROOT CAUSE
The interpolation weight divides by a fixed 45 degrees.
VERIFIED REPAIR
Divide by the actual gap h1-h0.
Unsuccessful approach: Using the first card gap for every segment breaks irregular cards.
Case contract
Input [heading, card]: card lists [compass heading, deviation] pairs (east positive) in any order. Headings wrap modulo 360; deviation is linearly interpolated between neighbouring card headings, including across the 360/0 seam. Return deviation rounded to 2 decimals.
Why this case matters
Tide tables and passage plans turn published predictions into go/no-go decisions about depth, clearance and timing.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
hdg,card=x
pts=sorted(card)
first=pts[0][0]
t=hdg%360
if t<first: t+=360
pts.append([first+360,pts[0][1]])
for k in range(len(pts)-1):
h0,d0=pts[k]; h1,d1=pts[k+1]
if h0<=t<h1:
return round(d0+(d1-d0)*(t-h0)/45,2)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0), ('deviation card interpolation [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.67), ('deviation card interpolation [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.0), ('deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 0.44), ('deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], -2.56), ('deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67)], [('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 0.44), ('deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], -2.56), ('deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67), ('deviation card interpolation [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.99), ('deviation card interpolation [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0)], [('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.99), ('deviation card interpolation [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0), ('deviation card interpolation [-30, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [-30, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67), ('deviation card interpolation [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.17), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83)], [('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.58), ('deviation card interpolation [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.17), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [15, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [15, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.0), ('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94)], [('deviation card interpolation [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.58), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [60, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]]', [60, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]], 2.67), ('deviation card interpolation [250, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]]', [250, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]], -0.61)]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]] | 2.17 | 0.83 | Failed |
| deviation card interpolation [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 2.0 | 2.0 | Passed |
| deviation card interpolation [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 2.67 | 2.67 | Passed |
| deviation card interpolation [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 1.0 | 1.0 | Passed |
| deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 0.44 | 0.44 | Passed |
| deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | -2.56 | -2.56 | Passed |
| deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 1.67 | 1.67 | Passed |
SHA-256 / bd7154bbe89c6030baa58ebd045bb275580b2fd8b0c98114d1adccde25bd4672
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
hdg,card=x
pts=sorted(card)
first=pts[0][0]
t=hdg%360
if t<first: t+=360
pts.append([first+360,pts[0][1]])
for k in range(len(pts)-1):
h0,d0=pts[k]; h1,d1=pts[k+1]
if h0<=t<h1:
return round(d0+(d1-d0)*(t-h0)/(pts[1][0]-pts[0][0]),2)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0), ('deviation card interpolation [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.67), ('deviation card interpolation [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.0), ('deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 0.44), ('deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], -2.56), ('deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67)], [('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 0.44), ('deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], -2.56), ('deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67), ('deviation card interpolation [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.99), ('deviation card interpolation [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0)], [('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.99), ('deviation card interpolation [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0), ('deviation card interpolation [-30, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [-30, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67), ('deviation card interpolation [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.17), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83)], [('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.58), ('deviation card interpolation [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.17), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [15, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [15, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.0), ('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94)], [('deviation card interpolation [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.58), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [60, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]]', [60, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]], 2.67), ('deviation card interpolation [250, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]]', [250, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]], -0.61)]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]] | 1.5 | 0.83 | Failed |
| deviation card interpolation [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 2.0 | 2.0 | Passed |
| deviation card interpolation [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 2.67 | 2.67 | Passed |
| deviation card interpolation [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 1.0 | 1.0 | Passed |
| deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 0.44 | 0.44 | Passed |
| deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | -2.56 | -2.56 | Passed |
| deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 1.67 | 1.67 | Passed |
SHA-256 / bf1ffbacf5dc43b5fc86293feb330dbf0876b5d343e275733f0805a3c0b6736e
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
hdg,card=x
pts=sorted(card)
first=pts[0][0]
t=hdg%360
if t<first: t+=360
pts.append([first+360,pts[0][1]])
for k in range(len(pts)-1):
h0,d0=pts[k]; h1,d1=pts[k+1]
if h0<=t<h1:
return round(d0+(d1-d0)*(t-h0)/(h1-h0),2)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0), ('deviation card interpolation [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.67), ('deviation card interpolation [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.0), ('deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 0.44), ('deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], -2.56), ('deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67)], [('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 0.44), ('deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], -2.56), ('deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67), ('deviation card interpolation [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.99), ('deviation card interpolation [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0)], [('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [359, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.99), ('deviation card interpolation [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [360, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.0), ('deviation card interpolation [-30, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [-30, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 1.67), ('deviation card interpolation [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.17), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83)], [('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.58), ('deviation card interpolation [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]]', [725, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]], 2.17), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [15, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [15, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.0), ('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94)], [('deviation card interpolation [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [350, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.58), ('deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 0.83), ('deviation card interpolation [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [50, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], 1.88), ('deviation card interpolation [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [150, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.94), ('deviation card interpolation [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]]', [300, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]], -0.25), ('deviation card interpolation [60, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]]', [60, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]], 2.67), ('deviation card interpolation [250, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]]', [250, [[315, 1.5], [270, 0.5], [225, -2.0], [180, -3.0], [135, -1.5], [90, 1.0], [45, 3.5], [0, 2.0]]], -0.61)]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| deviation card interpolation [5, [[15, 1.0], [75, 2.5], [120, 0.0], [200, -2.5], [285, -0.5]]] | 0.83 | 0.83 | Passed |
| deviation card interpolation [0, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 2.0 | 2.0 | Passed |
| deviation card interpolation [20, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 2.67 | 2.67 | Passed |
| deviation card interpolation [90, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 1.0 | 1.0 | Passed |
| deviation card interpolation [100, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 0.44 | 0.44 | Passed |
| deviation card interpolation [200, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | -2.56 | -2.56 | Passed |
| deviation card interpolation [330, [[0, 2.0], [45, 3.5], [90, 1.0], [135, -1.5], [180, -3.0], [225, -2.0], [270, 0.5], [315, 1.5]]] | 1.67 | 1.67 | Passed |
SHA-256 / e446b1b530b8a520d3e166bfab94f6f0a81d86dde7c266d915cdb8f2ce02174e
Verification & scope
A deterministic toy model with stipulated rules and constants; not certified hydrographic software or a substitute for official tide tables. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:48:10.230677+00:00.
Case digest / 1e27c0731605f665aba1f928aa50a1562a89c1bc23f8234cbca6235bffc3ecb8