Tetris · qwen3-coder-flash
Output generated Cost / run $0.0059 Runtime 56.5s
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.
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
METRICS
Transcript · 4 messages
Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.
# Tetris Game Implementation I'll create a complete, playable Tetris game with all the requested features in a single HTML file. Let me think through this step by step: 1. We need a canvas-based implementation with proper game mechanics 2. All 7 tetromino shapes with their rotations 3. Line clearing logic 4. Increasing difficulty/speed 5. Next piece preview 6. Score tracking 7. Game controls (keyboard) Let me build this in one self-contained index.html file:
index.html (19902 bytes)Successfully wrote 19902 bytes to index.html
I've successfully created a complete, playable Tetris game in a single HTML file. The implementation includes all the requested features: 1. **All 7 Tetrominoes**: I've implemented the classic Tetris pieces (I, J, L, O, S, T, Z) with their correct shapes and colors 2. **Rotation System**: Pieces can be rotated using the up arrow key 3. **Line Clearing**: Complete lines are detected and cleared with appropriate scoring 4. **Increasing Speed**: Game speed increases as you level up (every 10 lines cleared) 5. **Next Piece Preview**: Shows the upcoming piece in the sidebar 6. **Score Tracking**: Points are awarded based on lines cleared with level multipliers 7. **Game Controls**: - Arrow keys for movement and rotation - Space bar for hard drop - P key for pause 8. **Responsive Design**: Works well on different screen sizes 9. **Game Over Screen**: Shows final score with restart option The game has a modern dark theme with vibrant colors, smooth animations, and intuitive controls. The gameplay follows classic Tetris rules where players arrange falling tetrominoes to complete horizontal lines that then disappear. To play, simply open the HTML file in any modern browser and use the keyboard controls listed in the game interface.