# Drawn fish ## What this builds A two-part page: a drawing pad and a tank. The person sketches a fish in a few strokes, optionally names it, and it appears in the tank and swims with a simple gait. Other fish can be loaded from a store. In checks the store is fake and in-process; no public server is used. The swimming and the stroke format are original. Read `spekkr.inputs.json` first. `title` labels the pad. `tank_cap` limits how many fish are in the tank. `bubbles` and `names` change the chrome. `paper` is the pad's background. ## Out of scope - A public server or a live shared tank in the checks. - Accounts or moderation tools. - A 3D render of the fish. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. A drawing - A stroke is a list of points in a 400 by 240 pad, with a width and a colour from a five-colour set. - A fixture drawing `fixtures/fish-amber.json` is accepted: at least one stroke, at most 64, inside the pad. - An empty drawing, or a stroke outside the pad, is refused with a message. Accept when: the fixture is accepted, an empty drawing is refused, and a point at (401, 0) is refused. ### R2. The tank API - `POST /fish` with a drawing (and a name if `names` is on) stores a fish and returns an id. - In tests, the store is an in-memory fake. `GET /tank` lists the current fish, oldest first, up to `tank_cap`. - When the cap is exceeded, the oldest fish is dropped from the list. Accept when: posting the fixture then `tank_cap` others leaves the fixture gone and the list length equal to the cap. ### R3. Swimming - A fish is a sprite made from its strokes, centred, facing right by default. - It swims with a periodic gait: x increases at 40 px/s, wrapping the tank; y follows a 16 px sine of period 2 s. - The gait is a pure function of time and the fish's seed, so a screenshot is stable. Accept when: at t = 0 and t = 1 s the fixture fish is at the positions in `design.md`, within 1 px, and a mid-swim screenshot matches the golden. ### R4. Files - One command runs the accept/refuse tests, the fake-store cap test, the gait test, and writes the four screenshots. No network. Accept when: the command passes with `names` on and off. ### R5. Inputs - The build reads `spekkr.inputs.json`. Settings label the UI, options turn features on or off, and a swap must be one of its choices. - A value outside a stated range, or a swap that is not one of its choices, is refused before the app starts its checks, with a message that names the key. Accept when: the default inputs render, an illegal swap is refused by name, and changing a visible setting (for example the title) shows up in a later check. ## Verification A fixture drawing is accepted and appears in the tank API. Multi-client and cap tests use an in-memory fake store, not a public server. The fish swims on a documented gait, and a mid-swim frame is checked. No network is required in the checks. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to draw, how to run the checks, and how to swap in a real store later.