FA-97601 / Knitting and sewing pattern grading / Open access
Quilt binding strip planner: diagonal join loss · case 01
The planner cuts an extra strip because it counts a join on the last strip.
ROOT CAUSE
n strips are charged n joins instead of n-1.
THE FAILURE
n strips are charged n joins instead of n-1.
Unsuccessful approach: Doubling the loss per join over-buys.
Case contract
Usable strip length = fabric_width - 2*selvage. Joining n strips with diagonal seams loses strip_width per join (n-1 joins). Need perimeter + tail. n is the smallest count with n*usable - (n-1)*strip_width >= need. Return [n, fabric cut length n*strip_width, surplus]; usable <= strip_width -> "error: fabric too narrow".
Why this case matters
Quilters cut width-of-fabric strips and join them diagonally to bind the quilt edge.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(perimeter, strip_width, fabric_width, selvage, tail):
usable = fabric_width - 2 * selvage
if usable <= strip_width:
return 'error: fabric too narrow'
need = perimeter + tail
def length(n):
return n * usable - n * strip_width
n = 1
while length(n) < need:
n += 1
return [n, n * strip_width, length(n) - need]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: diagonal join loss', [600, 5, 140, 1, 30], [5, 25, 40]],
['repair check: diagonal join loss', [600, 6.5, 140, 1, 25], [5, 32.5, 39.0]],
['generated control 1', [200, 6, 140, 0, 25], [2, 12, 49]],
['generated control 2', [350, 5, 150, 0, 25], [3, 15, 65]],
['generated control 3', [200, 4, 107, 0, 25], [3, 12, 88]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: diagonal join loss', [420, 6, 150, 0, 30], [4, 24, 132]],
['repair check: diagonal join loss', [350, 6, 150, 0, 25], [3, 18, 63]],
['generated control 1', [420, 4, 140, 0, 30], [4, 16, 98]],
['generated control 2', [350, 5, 110, 0, 30], [4, 20, 45]],
['generated control 3', [150, 6, 150, 2, 30], [2, 12, 106]]],
[['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['regression: diagonal join loss', [600, 6, 150, 0, 20], [5, 30, 106]],
['repair check: diagonal join loss', [420, 6.5, 150, 0, 30], [4, 26.0, 130.5]],
['generated control 1', [150, 6, 150, 0, 25], [2, 12, 119]],
['generated control 2', [280, 5, 140, 2, 30], [3, 15, 88]],
['generated control 3', [150, 5, 107, 0, 0], [2, 10, 59]]],
[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: diagonal join loss', [600, 5, 150, 0, 0], [5, 25, 130]],
['repair check: diagonal join loss', [280, 6.5, 107, 0, 30], [4, 26.0, 98.5]],
['generated control 1', [420, 4, 110, 1, 0], [4, 16, 0]],
['generated control 2', [200, 6.5, 150, 0, 25], [2, 13.0, 68.5]],
['generated control 3', [350, 5, 110, 2, 0], [4, 20, 59]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: diagonal join loss', [150, 4, 140, 2, 0], [2, 8, 118]],
['repair check: diagonal join loss', [600, 4, 140, 1, 25], [5, 20, 49]],
['generated control 1', [280, 6, 107, 1, 30], [4, 24, 92]],
['generated control 2', [600, 4, 140, 0, 0], [5, 20, 84]],
['generated control 3', [200, 5, 107, 2, 30], [3, 15, 69]]]]
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 |
|---|---|---|---|
| baby quilt | [3, 18, 1] | [3, 18, 7] | Failed |
| two strips | [2, 12, 4] | [2, 12, 10] | Failed |
| narrow fabric | error: fabric too narrow | error: fabric too narrow | Passed |
| regression: diagonal join loss | [5, 25, 35] | [5, 25, 40] | Failed |
| repair check: diagonal join loss | [5, 32.5, 32.5] | [5, 32.5, 39.0] | Failed |
| generated control 1 | [2, 12, 43] | [2, 12, 49] | Failed |
| generated control 2 | [3, 15, 60] | [3, 15, 65] | Failed |
| generated control 3 | [3, 12, 84] | [3, 12, 88] | Failed |
SHA-256 / d4b19e5378a71d51452aa3f3c1902c21e5b9eea213786b2990a798d4b25611d0
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(perimeter, strip_width, fabric_width, selvage, tail):
usable = fabric_width - 2 * selvage
if usable <= strip_width:
return 'error: fabric too narrow'
need = perimeter + tail
def length(n):
return n * usable - (n - 1) * 2 * strip_width
n = 1
while length(n) < need:
n += 1
return [n, n * strip_width, length(n) - need]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: diagonal join loss', [600, 5, 140, 1, 30], [5, 25, 40]],
['repair check: diagonal join loss', [600, 6.5, 140, 1, 25], [5, 32.5, 39.0]],
['generated control 1', [200, 6, 140, 0, 25], [2, 12, 49]],
['generated control 2', [350, 5, 150, 0, 25], [3, 15, 65]],
['generated control 3', [200, 4, 107, 0, 25], [3, 12, 88]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: diagonal join loss', [420, 6, 150, 0, 30], [4, 24, 132]],
['repair check: diagonal join loss', [350, 6, 150, 0, 25], [3, 18, 63]],
['generated control 1', [420, 4, 140, 0, 30], [4, 16, 98]],
['generated control 2', [350, 5, 110, 0, 30], [4, 20, 45]],
['generated control 3', [150, 6, 150, 2, 30], [2, 12, 106]]],
[['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['regression: diagonal join loss', [600, 6, 150, 0, 20], [5, 30, 106]],
['repair check: diagonal join loss', [420, 6.5, 150, 0, 30], [4, 26.0, 130.5]],
['generated control 1', [150, 6, 150, 0, 25], [2, 12, 119]],
['generated control 2', [280, 5, 140, 2, 30], [3, 15, 88]],
['generated control 3', [150, 5, 107, 0, 0], [2, 10, 59]]],
[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: diagonal join loss', [600, 5, 150, 0, 0], [5, 25, 130]],
['repair check: diagonal join loss', [280, 6.5, 107, 0, 30], [4, 26.0, 98.5]],
['generated control 1', [420, 4, 110, 1, 0], [4, 16, 0]],
['generated control 2', [200, 6.5, 150, 0, 25], [2, 13.0, 68.5]],
['generated control 3', [350, 5, 110, 2, 0], [4, 20, 59]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: diagonal join loss', [150, 4, 140, 2, 0], [2, 8, 118]],
['repair check: diagonal join loss', [600, 4, 140, 1, 25], [5, 20, 49]],
['generated control 1', [280, 6, 107, 1, 30], [4, 24, 92]],
['generated control 2', [600, 4, 140, 0, 0], [5, 20, 84]],
['generated control 3', [200, 5, 107, 2, 30], [3, 15, 69]]]]
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 |
|---|---|---|---|
| baby quilt | [4, 24, 91] | [3, 18, 7] | Failed |
| two strips | [2, 12, 4] | [2, 12, 10] | Failed |
| narrow fabric | error: fabric too narrow | error: fabric too narrow | Passed |
| regression: diagonal join loss | [5, 25, 20] | [5, 25, 40] | Failed |
| repair check: diagonal join loss | [5, 32.5, 13.0] | [5, 32.5, 39.0] | Failed |
| generated control 1 | [2, 12, 43] | [2, 12, 49] | Failed |
| generated control 2 | [3, 15, 55] | [3, 15, 65] | Failed |
| generated control 3 | [3, 12, 80] | [3, 12, 88] | Failed |
SHA-256 / c88526c02349d0fefaa4a07e4f91b683b035359f10b3b073f673abf985731d46
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic toy contract stated in full here; it is a bounded teaching model, not an authoritative reference or standards implementation. 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:52:33.778154+00:00.
Case digest / 65564fa4f9f9d2d88bed30d1a0b2a01c081ed008f08fb5611cde10be2d9b9065