Tetris · kimi-k2.7-code
Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.
transcript · 6 messages
Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.
thinking
The user wants a playable Tetris game in a single index.html file with: - Canvas-based - All seven tetrominoes - Rotation - Line clears - Increasing speed - Next-piece preview - Score I'll create a self-contained HTML file with inline CSS and JS. I need to make sure it uses no external resources. Let me plan the code: 1. HTML structure with canvas for game and preview 2. CSS for layout 3. JavaScript game logic: - Tetromino definitions (I, O, T, S, Z, J, L) - Game board (10x20) - Piece movement/rotation - Collision detection - Line clearing - Scoring - Speed increase - Next piece preview - Game loop - Controls I'll write the complete file directly.
/workspace/index.html (15212 bytes)Successfully wrote 15212 bytes to /workspace/index.html
thinking
Let me verify the file exists and is correct.
{"command":"ls -l /workspace/index.html && head -20 /workspace/index.html && echo '---' && tail -10 /workspace/index.html"}-rw-r--r-- 1 node node 15220 Jul 10 00:31 /workspace/index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Tetris</title> <style> :root { --bg: #111; --panel: #1a1a1a; --text: #eee; --accent: #0ff; } * { margin: 0; padding: 0; box-sizing: border-box; } --- updateUI(); }); restartBtn.addEventListener('click', resetGame); resetGame(); </script> </body> </html>
thinking
The file is written. It contains: - Canvas-based board with 10x20 grid - All 7 tetrominoes (I, O, T, S, Z, J, L) - Rotation with wall kicks - Line clears with scoring - Increasing speed as level advances - Next piece preview - Score, lines, level display - Ghost piece - Hard drop / soft drop - Pause - Game over / restart Everything is inline with no external resources.
Done! Built a fully self-contained playable Tetris at `/workspace/index.html`. Features included: - Canvas-based 10×20 Tetris board - All 7 tetrominoes (I, O, T, S, Z, J, L) with distinct colors - Rotation with basic wall kicks - Line clearing with scoring - Increasing speed every level (level up every 10 lines) - Next-piece preview panel - Ghost piece showing hard-drop landing - Score, lines, and level displays - Soft drop, hard drop, and pause controls - Game over screen with restart Controls: - ← / → : Move - ↑ : Rotate - ↓ : Soft drop - Space : Hard drop - P : Pause Open `index.html` in any modern browser to play — no network 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
Functional Tetris with falling pieces, next preview, score/lines/level, and pieces respond to keyboard controls including hard drop and rotation.
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.