# Arcade in a PDF ## What this builds A one-page PDF that is also a game: pieces fall in a well, the person rotates and slides them with buttons or keys the viewer supports, and a full line disappears. The hook is the format. The piece shapes and the art are original. A test driver talks to the PDF (or to the same script the PDF embeds) and can start a game, place a piece, and clear a line without a person present. Read `spekkr.inputs.json` first. `title` is drawn on the first page. `width` and `height` size the well. `set` chooses the shapes. `next_piece` and `ghost` add previews. ## Out of scope - A copyrighted piece set or someone else's art. - A multi-page story or a PDF that needs a paid viewer plug-in. - Network, accounts or a score server. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. The page - The file is a valid PDF. Opening it shows one page with the well, the title, a score, and the controls. - The well is `width` by `height` cells. Each cell is square. - The same file plays in a scriptable viewer used by the tests. Accept when: a tool reports a single page, and a rendered first page matches `first-page` within the tolerance in `design.md`. ### R2. Pieces - The `seven` set has the seven shapes in `design.md`, each a set of four cells. The `five` set is the first five of those. - A bag randomiser, seeded, deals the set without a repeat until the bag is empty. - Rotate is 90 degrees about the documented origin. Wall kicks follow the small table in `design.md`. Accept when: unit tests place, rotate and kick every shape as in the table, and a seeded bag of 14 `seven` pieces contains each shape twice. ### R3. A driven game - The driver can start a game with the seed in `design.md`, spawn a documented first piece, slide it, rotate it, and hard-drop it. - The fixture in `design.md` fills one line, clears it, adds 100 to the score, and leaves the well as in the after-clear grid. - The same script is what the PDF embeds, so the driver and the file do not drift. Accept when: the driver starts a game, places the fixture piece, clears a line, and reads score 100 and the after-clear grid. ### R4. Screenshots and files - Frames are rendered from the PDF or from the same renderer: first-page at spawn, piece-falling mid-drop, line-clear on the flash frame, after-lock after the clear. - One command builds the PDF, runs the driver, and writes the frames. No network. Accept when: the command passes for both piece sets, and the frames match the goldens. ### 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 An automated driver (or the embedded script under a test harness) starts a game, places a piece, and clears a line. The first page and three later frames are rendered and checked against goldens. The piece set and art are original. No network and no paid viewer. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to open the PDF, how to run the driver, and how to change the well size.