2048 · glm-5.2
Build a playable 2048 game with arrow-key tile sliding and merging, smooth animations, a score, and win and lose states.
transcript · 6 messages
Build a playable 2048 game with arrow-key tile sliding and merging, smooth animations, a score, and win and lose states.
thinking
Let me build a 2048 game in a single index.html file. I'll include smooth animations, arrow-key controls, score tracking, and win/lose states.
I'll build a complete 2048 game with smooth animations, score tracking, and win/lose states.
index.html (18146 bytes)Successfully wrote 18146 bytes to index.html
{"command":"ls -la index.html && echo \"---\" && head -5 index.html"}-rw-r--r-- 1 node node 18146 Jul 10 00:34 index.html --- <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
Done. I built a complete, self-contained **2048** game in `index.html` (no external resources, all CSS/JS inline). **Features:** - **Arrow keys / WASD + swipe** controls to slide all tiles in a direction - **Tile merging** — equal adjacent tiles combine into double their value, with the classic 2048 color palette - **Smooth animations** — tiles slide to their destination via CSS `transform` transitions (~130ms), merged tiles pop-scale, and new tiles pop-in - **Score + Best** tracking (best persisted to `localStorage`) - **Win state** — reaching 2048 shows a "You win!" overlay with a "Keep going" option to continue for higher scores - **Lose state** — when the board is full with no valid moves, a "Game over" overlay appears - **New Game** button and overlay buttons to restart anytime - Responsive board that resizes tile font/dimensions on window resize The slide animation works by updating each tile's CSS `transform` (driven by a `--pos` custom property), then removing merged-away source tiles after the transition completes, and finally spawning a new random tile (90% chance 2, 10% chance 4). You can open `index.html` directly in a browser to play.
TAKE IT TO CODE
A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.
RUN
EVALUATION
2048 game responds to arrow keys and WASD with tile sliding and score updates; merges and layout look correct.
Vision grade · anthropic/claude-sonnet-5
MEASUREMENTS
Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.