Skip to content
🌐 Browser2014Gabriele CirulliEASY

2048 rebuild deck

EASY

Nothing here is hard except one rule — a tile produced by a merge is locked for the rest of that move — and the original is MIT-licensed on GitHub anyway.

You will get essentially the whole thing.

The whole game is one function and that function has exactly one trap in it. An agent will happily hand you a slide-and-merge that turns 2,2,2,2 into 8, and you will not notice for an hour because it still looks correct in motion. Test that case before anything else, then spend all remaining effort on the tile animation, because the movement is most of why anyone played this. Worth knowing that Cirulli built it in a weekend on top of an existing clone lineage and open-sourced it the same week.

Difficulty
EASY · 1 of 5
First playable
An evening
The original
1 team-years
Released
2014 · Browser
Genre
Sliding Tile Puzzle
The one-shot build prompt
Build a 4x4 sliding-number puzzle as a single self-contained HTML file. DOM or Canvas 2D, no build step, no dependencies.

Requirements:
- Arrow keys and touch swipe slide every tile as far as it will go in that direction. Equal-valued tiles that collide merge into their sum.
- The rule that decides whether this feels right: a tile produced by a merge is LOCKED for the rest of that turn. Process each row or column starting from the far edge and mark merged tiles so they cannot merge twice in one move. A row of 2,2,2,2 must become 4,4 and never 8.
- Only spawn a new tile if the board actually changed. Spawn into a random empty cell, 90% a 2 and 10% a 4.
- Slides animate over 100ms ease-out. New tiles pop in over 200ms scaling from 0.3 to 1. Merged tiles get a 1.15 scale bump that settles in 120ms.
- Game over when there is no empty cell AND no pair of equal orthogonal neighbours. Check both conditions, not just the first.
- Keep tile colours, text colours and font sizes in a tiles.json file keyed by value, so the palette swaps without touching game logic.
- Score, best score in localStorage, and a single-step undo.

Definition of done: a row of 2,2,2,2 collapses to 4,4 in one move, and the game only ends when I genuinely have no legal move left.
What you lose
  • Nothing, honestly. The original is MIT-licensed and the author pushed the source to GitHub himself
  • The exact warm beige-to-orange tile ramp that everybody's eyes learned in March 2014
  • The fortnight in 2014 when every open-plan office quietly stopped working
What to steal

Moves that return a transition list

The puzzle logic is twenty lines; the reason it feels good is that the renderer never touches the model. Get a move to return a list of transitions rather than just a new board, and you can bolt convincing motion onto any grid game you write afterwards — match-three, roguelike, chess — without the logic ever knowing that animation exists.

ScopeAn evening— build just this, not the game

Build a toy that proves a grid game's renderer should not share state with its grid. Single self-contained HTML file, Canvas 2D, no build step, no dependencies.

- Model: a 4x4 array of integers plus one pure function move(grid, direction) that slides everything to the far edge, combines equal neighbours, and returns a NEW grid AND a transition list of {fromRow, fromCol, toRow, toCol, value, merged, spawned}. The model has no timers and knows nothing about pixels.
- Renderer: a sprite pool that consumes the transition list. Tween each sprite from old cell to new over 110ms ease-out, pop spawned sprites from 0.3 to 1 scale, give merged sprites a 1.15 bump that settles in 120ms.
- Input pressed during a tween queues; it must never mutate the model mid-animation.
- A toggle switches to snap rendering with no tweening at all.
- A debug key prints the last transition list beside the board.

Definition of done: tweened and snapped modes produce an identical final grid every time, and the only difference between them is one render function.
Make it different

Not a clone — 2048 re-themed and cut down to something you can finish. The angle is the important reel: it is what turns a project into a weekend. 5,880 ways to land.

Jianghu Flatland

2048, but 2D instead of 3D, set in a wuxia martial world. Rendered in ASCII terminal.

Themea wuxia martial world
Angle2D instead of 3D
LookASCII terminal
Build a browser game called "Jianghu Flatland".

The pitch in one line: a sliding tile puzzle in the spirit of 2048, but 2D instead of 3D, set in a wuxia martial world.

WHAT THIS IS
Take the SHAPE of 2048 — its core loop, and whatever makes that loop good — and rebuild it as your own game in a different world at a smaller scope. Use your own names, art and audio, which you want anyway: a reskin of somebody else's game is less interesting than a new one that works the same way.

THE ANGLE — this is the important constraint, honour it above everything else
2D instead of 3D. Canvas 2D and sprites. The mechanics survive the dimension drop; the asset budget falls by an order of magnitude.
This is what makes the project finishable. If a decision would push the scope back towards the original's, take the smaller option every time.

THE THEME
A wuxia martial world. Movement is the fantasy — rooftops, bamboo and impossible leaps — and honour is a mechanic with teeth.
The theme is not a coat of paint. Let it change what the mechanics mean — a reload, a health pack and a locked door should all be things that make sense in this world and nowhere else.

LOOK
ASCII terminal. A monospace character grid as the only renderer, colour via ANSI-style palette, and every animation expressed as glyph changes.

REQUIREMENTS
- Runs in a browser with no build step. Canvas 2D unless the angle genuinely requires 3D, in which case three.js.
- Fixed-timestep update loop with interpolated rendering, so it behaves the same at 60Hz and 144Hz.
- Every tuning constant in one CONFIG object at the top, exposed as live sliders in a debug panel. You will find the feel by dragging those, not by prompting.
- All content — levels, entities, balance numbers — in JSON or plain data files, never inline in the logic.
- Audio generated with the Web Audio API rather than asset files.
- Respect prefers-reduced-motion: keep the fades, drop the shake and the parallax.

BUILD ORDER
1. The core loop with placeholder rectangles, at the reduced scope the angle demands. No theme, no art, no audio. Make it fun as rectangles first.
2. The angle's consequences. Cutting to bots, or to turn-based, or to one level changes the design rather than just shrinking it — find out how and rewrite step 1.
3. The theme, as content and data.
4. The look, applied last as a rendering layer over a game that already works.

Start by writing a one-page plan: the core loop, what the angle removes and what that frees you to do properly, and what you are deliberately leaving out. Wait for me to approve it before writing code.
Prior art — read before you build

Half the time one of these already does what you wanted, and the other half it saves you a week of solving a problem someone documented in 1997.

Did you build it?
0Share on X

One count per game. No account — it is tied to a salted hash of your IP, which is not stored in a form anyone can reverse. Every build adds 1 team-years to the counter on the homepage.

Questions

How hard is 2048 to rebuild with an AI agent?

Yes — every game is buildable at some scope. The question is how hard, and 2048 is EASY (1 of 5). You will get essentially the whole thing. Nothing here is hard except one rule — a tile produced by a merge is locked for the rest of that move — and the original is MIT-licensed on GitHub anyway. Reckon on an evening to something you can actually play — not to something that matches the 1 team-years Gabriele Cirulli spent.

What makes 2048 hard to rebuild?

Nothing here is hard except one rule — a tile produced by a merge is locked for the rest of that move — and the original is MIT-licensed on GitHub anyway. That is why it sits at EASY rather than a tier either side of it. If you want the idea without the project, the transferable part is moves that return a transition list — an evening of work.

How long does it take to build a 2048 clone?

Wrong question, and it is worth saying why. Nobody rebuilds 2048 — the original took Gabriele Cirulli on the order of 1 team-years, released in 2014 on Browser. What you can do is reach something playable and genuinely yours in about an evening, and then keep going for as long as it stays interesting. Any figure that claims otherwise is measuring a prototype and calling it a game.

What do I lose by building my own 2048?

Nothing, honestly. The original is MIT-licensed and the author pushed the source to GitHub himself. The exact warm beige-to-orange tile ramp that everybody's eyes learned in March 2014. The fortnight in 2014 when every open-plan office quietly stopped working. Those are the parts a prompt will not hand you.

Which AI coding agent should I use to build it?

Any of Claude Code, Codex or Cursor will handle this prompt. Paste it as your first message, let the agent scaffold the project, then iterate on feel — the second, third and tenth prompts are where a game actually gets good. Work in an empty folder or a fresh git branch so you can throw it away cheaply.

Get the next game

One email when new games go on the list. No other reason to email you, ever.