The four-by-four game applies that rule in each direction, adds merged values to the score, and spawns only when the board changes. A labeled Merge lab preset makes the before-and-after row inspectable with a deterministic spawn.

Use the worked example
Load Merge lab and press Left. Its first row becomes 4, 4, 0, 0 before a new 2 is placed in the first empty cell. The score increases by four. Keep going acknowledges a first 2048 goal without discarding the board; New game starts a fresh session.
Trace the result step by step
Use 16 cells in a maintained board state. For each line in the move direction, remove zeros, merge neighboring equal tiles once, and pad the result with zeros. A newly merged tile cannot merge again during that move.
Equal-number merging and the 2048 goal follow the creator's classic game. The creator's game manager also records which tiles have already merged. Here, the teaching version exposes the score change and pre-spawn rows so you can inspect the same once-per-move rule.
Focus the board to use arrow keys or W, A, S, D, or choose a direction button. Keys pressed on New game or another control outside the board leave the game alone. Each direction uses the same line-compression and once-per-move merging rule.
Load No-op lab, whose top row is 2, 4, 8, 16, and press Left. No tile can move or merge in that direction. The move count and score remain zero, and no new tile appears. The note below the board identifies the unchanged action.
For each changed move, the teaching game commits the merged board and score once, then places one 2 in the first empty cell. The move explanation shows the board before the new tile appears. This declared deterministic policy makes a changed result reproducible; it does not describe the classic game’s random spawning.
Goal lab starts with 1024 beside 1024. Move Left to reach 2048, then choose Keep going. The score and board remain available for another move; acknowledging the goal is different from starting a New game. New game clears the score and changed-move count and places its two starting tiles.
A full board is not automatically a loss. If horizontally or vertically adjacent equal tiles remain, a legal merge exists. Diagonal equality alone does not provide one.
The Full loss board preset alternates 2 and 4 in a checkerboard. It has no empty cell and no equal horizontal or vertical neighbor. A different filled board containing an equal orthogonal pair can still have a legal merge.
| Input line | Result before spawn | Score increase | Explanation |
|---|---|---|---|
| [2, 2, 2, 2] | [4, 4, 0, 0] | 8 | Two independent merges produce 4 each. |
| [2, 2, 4, 0] | [4, 4, 0, 0] | 4 | Newly produced 4 cannot merge again. |
| [2, 0, 2, 0] | [4, 0, 0, 0] | 4 | Compression brings the equal pair together. |
| [2, 4, 8, 16] | Unchanged | 0 | No movement or merge is possible to the left. |
Copy a prompt for this example
Create a self-contained HTML slide-and-merge teaching game with a four-by-four board, directional buttons, a score, and a changed-move count. Give it an original readable tile design and a text explanation of each move before spawning.
For each directional line, remove zeros, merge neighboring equal input tiles once, and pad with zeros. A tile produced by a merge cannot merge again during that move. Before spawning, a left move turns 2, 2, 4, 0 into 4, 4, 0, 0 and adds four points; 2, 2, 2, 2 becomes 4, 4, 0, 0 for eight points.
Use an explicitly deterministic teaching policy: after a changed board, put one 2 in the first empty cell in row order. An unchanged move adds no tile, score, or move. New game starts with 2 at indices zero and five.
Include Merge lab with first row 2, 2, 4, 0; No-op lab with 2, 4, 8, 16; Goal lab with 1024, 1024, 0, 0; and an alternating full 2/4 checkerboard that has no legal move. Empty remaining rows belong to the first three presets.
The first 2048 goal pauses for Keep going, which preserves the board and score. A full board loses only when no equal orthogonal neighbors remain. Support directional buttons and arrow or WASD input without intercepting typing in fields. Return one responsive HTML file.
Compare the displayed move explanation with the source before changing merge order or spawn policy. NOS can preview the prepared HTML for that review. Use the fixed presets to inspect an unchanged move and a full-board loss, and keep the declared deterministic teaching spawn separate from the classic game’s random behavior.