oneshotlm
Compare all models on this prompt →

Tetris · glm-4.7

Output generated Cost / run $0.0101 Runtime 140.6s

Prompt for this run

Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.

⛨ sandboxed Open in new tab ↗

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.7
vendorZ.ai · GLM
harnesspi-agent
generated2026-07-22

METRICS

runtime140.6s
tokens in8.1k
tokens out5.4k
cached7.9k
cost / run$0.0101
Transcript · 4 messages
user

Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.

assistant
thinking
The user wants me to build a complete Tetris game in a single HTML file. Let me plan out what I need:

1. HTML structure with a canvas
2. CSS for styling
3. JavaScript for the game logic including:
   - All seven tetrominoes (I, O, T, S, Z, J, L)
   - Rotation system (wall kicks ideally, but basic rotation should work)
   - Line clearing with scoring
   - Increasing speed as levels progress
   - Next piece preview
   - Score tracking
   - Game over detection
   - Controls (arrow keys)

Let me write this all in one self-contained index.html file.

I'll create a complete Tetris game in a single HTML file with all the requested features. Let me build this:

→ write /workspace/index.html (21510 bytes)
toolResult

Successfully wrote 21510 bytes to /workspace/index.html

assistant
thinking
I've created a complete Tetris game in a single HTML file. Let me verify the file was created properly and maybe test it briefly if needed.

I've created a fully playable Tetris game in `index.html` with all the requested features: **Features included:** - ✅ **All 7 tetrominoes** (I, O, T, S, Z, J, L) with distinct colors - ✅ **Rotation** with wall kick support for smooth gameplay - ✅ **Line clears** with proper scoring (100/300/500/800 points for 1/2/3/4 lines) - ✅ **Increasing speed** - level increases every 10 lines, drop speed increases accordingly - ✅ **Next-piece preview** shown in a side panel - ✅ **Score tracking** - displays score, level, and lines cleared - ✅ **Ghost piece** - shows where the piece will land - ✅ **Hard drop** (Space bar) for instant placement - ✅ **Soft drop** (Down arrow) for faster descent - ✅ **Pause** (P key) functionality - ✅ **Game over** detection with restart option - ✅ **Bag randomization** for fair piece distribution **Controls:** - ← → : Move left/right - ↓ : Soft drop - ↑ : Rotate - Space : Hard drop - P : Pause/Resume The game has a modern dark theme with a gradient background, glowing borders, and polished UI. Just open the file in a browser to play!