# Merge tiles ## What this builds A sliding-tile merge game on a square board. Tiles slide until they hit an edge or another tile. Two tiles of the same value that collide merge into one tile of twice the value, once per tile per move, and the score grows by that new value. A 2048 tile is a win the person can keep playing past. A board with no legal move is stuck. The feel is tight and original; the art and typography are new. This is not a reskin of someone else's build. Read `spekkr.inputs.json` first. `title` labels the board. `start_tiles` is how many tiles are placed at the start. `size` is 4 or 5. `animations` and `undo` change the chrome. New tiles after a move use a seed. ## Out of scope - A copyrighted clone of a named commercial game, or its art. - Network, accounts, or a global leaderboard in the checks. - A board larger than 5 in this version. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Moves and merges - A move is one of four directions. Every tile slides as far as it can. Two equal tiles merge at most once per move. - The score increases by the value of each new merged tile. - After a move that changed the board, a new tile appears in a random empty cell: a 2 with probability 9/10, a 4 with 1/10, from the seed. Accept when: the merge fixtures in `design.md` produce the stated boards and scores, including a case where a tile would otherwise merge twice. ### R2. Seed, win, stuck - Seed 17 on a 4 by 4 board with 2 start tiles produces the starting board in `fixtures/merge-seed-17.txt`. - A 2048 tile sets a win flag; play may continue. A board with no legal move in any direction is stuck. - The mid-game script `fixtures/merge-midgame.json` reaches a documented board, score, and at least one 64 tile. Accept when: the seed-17 start matches, the mid-game script matches, a fixture board with a 2048 is flagged won, and a fixture full board with no neighbours equal is stuck. ### R3. Chrome and files - If `undo` is on, one undo restores the board and score from before the last move; a second undo does nothing. - Animations, if on, last 120 ms; tests may apply a move atomically. - One command runs the fixtures and writes start, mid-game, a merge frame, and a stuck frame. No network. Accept when: undo restores the mid-game board's previous position, and the four frames match the goldens. ### R4. 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 Merge and score tests cover single merges, a row that must not chain twice in one move, and the documented scores. A seeded board is used for the start and for a mid-game script. Win (a 2048 tile) and stuck states are tested. A golden mid-game screenshot is checked. No network and no third-party art. ## 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 pin a seed, and how to run the checks.