# Puzzle box ## What this builds A multi-stage puzzle box, modelled as code: panels that slide or lift in a documented order, ending in an optional secret compartment. Static and sliding clearances are the stated tolerances. A scripted solve path is checked for clearance at every step. Assembly and mid-solve renders are written. No physical print is required. Read `spekkr.inputs.json` first. `size` is the outer cube. `static_gap` and `slide_gap` are the two tolerances. `wall` is the shell. `secret` and `lid_inlay` add features. `tool` is the modeller. ## Out of scope - A branded puzzle-box name, or a patented sequence copied as a product claim. - A physical print, or the feel of a slide. - A prize or a real lock. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Tolerances and path - At rest, static mates have a gap of `static_gap` within 0.04 mm, and sliding mates have `slide_gap` within 0.04 mm. - The solve path in `fixtures/box-solve.json` (an ordered list of moves) can be applied with those gaps and no collision. A wrong first move is blocked. - If `secret` is on, the cavity is revealed only after the last legal move, and its volume is at least the figure in the file. Accept when: gaps match, the legal path opens the box (and the secret, if on), and a wrong first move is blocked. ### R2. Files and frames - Export the parts. Meshes watertight, min wall `wall`. Renders: closed, mid-solve, open, and a section. - One command builds, follows the path, and writes the renders. No print. Accept when: the command passes for both tools, and a too-tight slide gap (0) fails the path. ### 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 Stated tolerances (0.1 mm static and 0.2 mm sliding at the defaults) are measured on mating parts. A scripted solve path runs with clearance checks, and a wrong first move is blocked. Assembly and mid-solve renders 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 parts, how the path is listed, and that a print is optional.