# Interlocking puzzles ## What this builds A small family of interlocking mechanical puzzles, modelled as code. Piece counts and bounding boxes are listed. A scripted disassembly path is checked so pieces do not collide as they come apart, given the clearance. Printability (minimum walls, watertight meshes) is checked. Renders of the start and an exploded or mid-disassembly state are written. No physical print is required. Read `spekkr.inputs.json` first. `size` is the assembled cube. `clearance` is the sliding gap. `wall` is the minimum. `second` and `tray` add a second set and a tray. `tool` is the modeller. ## Out of scope - A patented puzzle's exact pieces, or a branded name in the id. - A physical print, or a claim of uniqueness of a famous design. - A competition judge on a real table. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Pieces and path - The first puzzle has the piece count in `design.md` (for example 6). Each piece's bounding box and volume match the file within 0.05 mm and 1%. - The scripted disassembly in `fixtures/puzzle-path.json` (a sequence of translations) keeps a clearance of `clearance` between pieces, with no collision, until they are apart. - A wrong order (a listed illegal first move) collides or is blocked, and the check reports it. Accept when: counts, boxes, the legal path, and the illegal first move all match. ### R2. Printability, files, frames - Each piece is watertight, min wall `wall`. Renders: assembled, exploded, a mid-path pose, and the tray if on. - One command builds, follows the path, and writes the renders. No print. Accept when: the command passes for both tools, and a second puzzle, if on, has its own path file that also passes. ### R3. Inputs - Numeric inputs are read from `spekkr.inputs.json` and must stay inside the ranges in the Inputs table in `design.md`. - A value outside a range is refused before modelling, with a message that names the key. - Options add or remove the features in that table. The `tool` swap selects CadQuery or OpenSCAD; both must meet the same numbers. Accept when: default and one out-of-range value are handled as above, and a second legal input set still matches the formulas in `design.md`. ### R4. Checks and report - One command builds the model at the defaults and at the person's inputs, measures it against `design.md`, and writes a short report. - A model broken on purpose, for example a wall thinner than `wall`, must fail the report. - The command exports the files this spec asks for (STL, and STEP when the tool can). No physical print is required. Accept when: the report says pass at the defaults and at the person's inputs, and fail on a deliberately broken model. ## Verification Piece counts and bounding boxes match a file. A scripted disassembly path runs with no collisions at the stated clearance, and a wrong first move is reported as blocked. Printability (min walls, watertight meshes) is checked. Renders of start and exploded or mid-path states are written. No physical print is required. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to export the pieces, how the path is listed, and that a print is optional.