2048 · deepseek-v3.1-terminus
Build a playable 2048 game with arrow-key tile sliding and merging, smooth animations, a score, and win and lose states.
transcript · 4 messages
Build a playable 2048 game with arrow-key tile sliding and merging, smooth animations, a score, and win and lose states.
thinking
We are building a single-page web app for the 2048 game.
Requirements:
- Arrow-key tile sliding and merging
- Smooth animations
- Score display
- Win and lose states
- All in one index.html file (CSS in <style>, JS in <script>)
We'll structure the HTML with a container for the game board, score, and messages.
The game logic will include:
- A 4x4 grid of tiles
- Movement in four directions (up, down, left, right)
- Merging tiles of the same value
- Adding new tiles (2 or 4) after each move
- Checking for win (2048 tile) and lose (no moves left)
We'll use CSS Grid for the board and absolute positioning for the tiles to allow animations.
Steps in the JavaScript:
- Initialize the game state (4x4 grid, score, game over flag)
- Handle keyboard events for arrow keys
- For each move:
- Slide tiles in the direction until they hit the wall or another tile
- Merge adjacent tiles of the same value in the direction of movement
- Update the score
- Add a new tile in a random empty cell
- Check for win/lose conditions
- Animate the tile movements and merges
We'll use CSS transitions for smooth animations.
Let's write the code accordingly.I'll build a complete 2048 game with all the requested features. Let me create the index.html file:
index.html (19316 bytes)Successfully wrote 19316 bytes to index.html
thinking
I've created a complete, playable 2048 game with all the requested features: **Features included:** - **Arrow-key controls** for tile sliding (up, down, left, right) - **Smooth animations** for tile movement and merging - **Score tracking** with best score persistence using localStorage - **Win state** when reaching the 2048 tile - **Lose state** when no more moves are possible - **Mobile support** with touch/swipe controls - **Responsive design** that works on different screen sizes - **Visual polish** with gradient backgrounds, glassmorphism effects, and proper tile colors **Game mechanics:** - Tiles slide in the direction pressed until they hit another tile or the edge - Matching tiles merge into one with their values added together - After each move, a new tile (2 or 4) appears randomly on the board - The game tracks your score based on merged tile values - Win by creating a 2048 tile, lose when the board is full with no possible merges The game is completely self-contained in a single `index.html` file with no external dependencies - it runs fully sandboxed with no network requests required.
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 correctly to arrow keys, tiles slide/merge and score updates; pointer inputs and WASD don't affect it as expected.
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.