oneshotlm
Compare all models on this prompt →

2048 · glm-4.5

Build a playable 2048 game with arrow-key tile sliding and merging, smooth animations, a score, and win and lose states.

⛨ sandboxed Open in new tab ↗
transcript · 4 messages
user

Build a playable 2048 game with arrow-key tile sliding and merging, smooth animations, a score, and win and lose states.

assistant
thinking
The user wants me to build a playable 2048 game in a single HTML file with:
1. Arrow-key tile sliding and merging
2. Smooth animations
3. A score display
4. Win and lose states

I'll create a complete, self-contained index.html file with CSS and JavaScript inline. Let me design this:

HTML structure:
- Header with title and score
- Game board (4x4 grid)
- Win/lose overlay messages
- New game button

CSS:
- Grid layout for the board
- Tile colors based on values
- Smooth animations for sliding and merging
- Responsive design

JavaScript:
- Game state management
- Tile movement logic
- Merging logic
- Random tile spawning
- Win condition (2048 tile)
- Lose condition (no moves available)
- Keyboard event handling
- Animation handling

Let me write this complete file.

I'll create a complete, playable 2048 game in a single HTML file with all the requested features.

write /tmp/ws/index.html (16636 bytes)
toolResult

Successfully wrote 16636 bytes to /tmp/ws/index.html

assistant
thinking
I've created a complete, self-contained 2048 game in index.html. Let me verify it's there and summarize what I built.

I've created a fully playable 2048 game in `index.html`. Here's what's included: **Features:** - **Arrow key controls**: Use ↑ ↓ ← → to slide tiles - **Smooth animations**: Tiles slide smoothly with CSS transitions, new tiles pop in with animation, merged tiles have a satisfying pop effect - **Score tracking**: Current score and best score (persisted in localStorage) - **Win state**: Reaching 2048 shows a win overlay with options to continue or start a new game - **Lose state**: When no moves are available, shows game over overlay with final score - **New Game button**: Start fresh anytime **Visual design:** - Gradient purple background - Color-coded tiles (2-2048+ with appropriate colors) - Clean, modern UI with rounded corners and shadows - Responsive layout centered on screen **Game mechanics:** - 4x4 grid with proper tile merging logic - Random tile spawning (90% chance of 2, 10% chance of 4) - Prevents invalid moves - Win/lose detection The game is completely self-contained with no external dependencies - all CSS and JavaScript are inline, and it runs entirely offline.

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

modelglm-4.5
vendorZ.ai · GLM
harnesspi-agent
generated2026-08-01

EVALUATION

3/5 working

2048 game responds correctly to arrow keys, sliding/merging tiles and updating score, but WASD not implemented.

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.

idle motion0.0%
on click0.0%
on drag0.0%
on wheel0.0%
on enter + space0.0%
on arrow keys5.2%
on w/a/s/d0.0%
frame spread38.1 / 255
console errors0
js errors none

METRICS

runtime74.4s
tokens in7.0k
tokens out4.3k
cached1.3k
cost / run$0.0130