From e4fc557aac046978de84ab55a635aea22ec8ac5d Mon Sep 17 00:00:00 2001 From: BruceChen Date: Tue, 14 Apr 2026 11:11:49 +0000 Subject: [PATCH] test: tune canonical live case selection --- tools/pathing_data/canonical-live-cases.json | 18 ++++++++--------- tools/pathing_theory/canonical.py | 21 +++++++++++++++++++- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tools/pathing_data/canonical-live-cases.json b/tools/pathing_data/canonical-live-cases.json index fed11b6f..f59f9606 100644 --- a/tools/pathing_data/canonical-live-cases.json +++ b/tools/pathing_data/canonical-live-cases.json @@ -100,7 +100,7 @@ } }, { - "case_id": "linear-ascend-sprint-mm12-gap5-dy1p0", + "case_id": "linear-ascend-sprint-mm12-gap2-dy1p0", "bucket_id": "linear:ascend:sprint:boundary", "family": "linear", "subfamily": "ascend", @@ -109,7 +109,7 @@ "difficulty_band": "boundary", "expected_result": "pass", "world_recipe_id": "linear-ascend", - "gap_blocks": 5, + "gap_blocks": 2, "delta_y": 1.0, "ceiling_height": null, "wall_width": null, @@ -119,7 +119,7 @@ "z": 100.5 }, "goal": { - "x": 106.0, + "x": 103.0, "y": 81.0, "z": 100.0 } @@ -175,7 +175,7 @@ } }, { - "case_id": "linear-descend-sprint-mm12-gap7-dym1p0", + "case_id": "linear-descend-sprint-mm12-gap2-dym1p0", "bucket_id": "linear:descend:sprint:boundary", "family": "linear", "subfamily": "descend", @@ -184,7 +184,7 @@ "difficulty_band": "boundary", "expected_result": "pass", "world_recipe_id": "linear-descend", - "gap_blocks": 7, + "gap_blocks": 2, "delta_y": -1.0, "ceiling_height": null, "wall_width": null, @@ -194,7 +194,7 @@ "z": 100.5 }, "goal": { - "x": 108.0, + "x": 103.0, "y": 79.0, "z": 100.0 } @@ -225,7 +225,7 @@ } }, { - "case_id": "linear-flat-sprint-mm12-gap6-dy0p0", + "case_id": "linear-flat-sprint-mm12-gap5-dy0p0", "bucket_id": "linear:flat:sprint:boundary", "family": "linear", "subfamily": "flat", @@ -234,7 +234,7 @@ "difficulty_band": "boundary", "expected_result": "pass", "world_recipe_id": "linear-flat", - "gap_blocks": 6, + "gap_blocks": 5, "delta_y": 0.0, "ceiling_height": null, "wall_width": null, @@ -244,7 +244,7 @@ "z": 100.5 }, "goal": { - "x": 107.0, + "x": 106.0, "y": 80.0, "z": 100.0 } diff --git a/tools/pathing_theory/canonical.py b/tools/pathing_theory/canonical.py index 8e9d9fba..fe568aef 100644 --- a/tools/pathing_theory/canonical.py +++ b/tools/pathing_theory/canonical.py @@ -22,6 +22,25 @@ def _canonical_goal(case: TheoryCase) -> tuple[dict[str, float], dict[str, float return start, {"x": float(goal_x), "y": 80.0, "z": 100.0} +def _select_boundary_case( + family: str, + subfamily: str, + reachable: list[TheoryCase], +) -> TheoryCase: + if family == "linear": + preferred_gap_by_subfamily = { + "flat": 5, + "ascend": 2, + "descend": 2, + } + preferred_gap = preferred_gap_by_subfamily.get(subfamily) + if preferred_gap is not None: + for case in reachable: + if case.gap_blocks == preferred_gap: + return case + return reachable[0] + + def build_canonical_live_cases(cases: list[TheoryCase]) -> list[CanonicalLiveCase]: live_candidate_cases = [ case @@ -58,7 +77,7 @@ def build_canonical_live_cases(cases: list[TheoryCase]) -> list[CanonicalLiveCas (case for case in reversed(reachable) if (case.margin or 0.0) >= 0.50), reachable[-1], ) - boundary = reachable[0] + boundary = _select_boundary_case(family, subfamily, reachable) selected.append(("easy", easy)) if boundary.case_id != easy.case_id: selected.append(("boundary", boundary))