# Password rules ## What this builds A single field and a list of rules. The first few rules are ordinary (a minimum length, a digit, a capital). Each time the current set is satisfied, a new, stranger rule is revealed. Later rules refer to earlier ones, to the text itself, and to small facts (a Roman numeral that equals the count of vowels, a chess move in algebraic notation, a moon phase emoji). This is an original rule script, not someone else's puzzle with the serial numbers filed off. Read `spekkr.inputs.json` first. `title` labels the page. `start_rules` is how many rules are visible at first. `script` chooses the long or short set. `show_why` and `timer` change the chrome. ## Out of scope - A real account or sign-up. Nothing is stored. - Network calls to look up facts. Every fact a rule needs is in `design.md`. - A public share of solutions. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. The field - One password field, a submit control, and a list of the rules that have been revealed so far. - Submit is allowed only as a way to re-check; checking also happens as the person types, on every change. - `title` is the heading. The current value is never logged or sent anywhere. Accept when: the page loads with an empty field and only `start_rules` rules visible. ### R2. Each rule - Every rule has an id, a short statement, and a pure function of the current text (and, where `design.md` says so, of the current date used as a fixture). - A rule is either satisfied or not. There is no third state. - The functions and their fixtures live in code and are listed in `design.md`. Accept when: unit tests for each rule pass against the examples in `design.md`, including at least one yes and one no for every rule. ### R3. Revealing the next rule - A rule past the opening set is revealed only when every currently visible rule is satisfied. - Revealing does not hide earlier rules. A later edit may break an earlier rule; the later ones stay visible and go red. - The game is won when every rule in the chosen script is visible and satisfied. Accept when: a fixture string that satisfies a known prefix of rules is accepted up to that prefix, and is rejected by the next rule, as in the table in `design.md`. ### R4. Messages - If `show_why` is on, an unsatisfied visible rule includes its short statement and, after a failed check, a one-line reason from `design.md`. - If `timer` is on, the elapsed time is shown, starting at the first keystroke, pausing when the window is hidden, and stopping at a win. Accept when: the prefix fixture shows reasons only for the unsatisfied next rule, and the timer stays at 0 until a first keystroke. ### R5. Files - One command runs every unit test and a short UI test of the prefix fixture, and writes the screenshots in `design.md`. Accept when: the command passes for both scripts, and for `start_rules` of 1 and of 5. ## Verification Unit tests cover each rule with at least one string that passes and one that fails. A checked fixture file satisfies a known prefix of rules and is rejected by the next. A second fixture satisfies the whole script. No rule reads the real date, the real moon, or the network. UI tests take the four screenshots. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to play, how to run the checks, and how to add a rule.