FA-97579 / Knitting and sewing pattern grading / Member archive
Cutting layout fabric length: layout sort order · case 04
Short pieces open rows that tall pieces then extend, wasting fabric.
Case contract
Pieces [w, h, qty] (cm; w across the fabric). A piece wider than the fabric is rotated if the fabric is not directional and its height fits, else "error: piece too wide". Expand qty, sort by (height, width) descending, then shelf-pack: start a new row when the row width plus the piece would exceed the fabric width; each row is as tall as its tallest piece. Return [length_cm, eighths_of_a_yard] with eighths = ceiling(length/91.44*8).
Why this case matters
Pattern envelopes and cutting planners estimate yardage from piece layouts and nap direction.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: layout sort order | [195, 18] | [180, 16] | 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 ↗