Snake · qwen3-coder
Output generated Cost / run $0.0029 Runtime 61.5s
Prompt for this run
Build a playable Snake game on a canvas with arrow-key controls, a growing tail, food, score, and a game-over and restart state.
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 Snake game on a canvas with arrow-key controls, a growing tail, food, score, and a game-over and restart state.
I'll create a complete Snake game in a single HTML file with all the features you requested. Let me build this step by step.
index.html (8567 bytes)Successfully wrote 8567 bytes to index.html
I've created a complete Snake game in a single HTML file with all the features you requested: 1. Canvas-based game with a grid layout 2. Arrow-key controls for movement 3. Snake that grows when it eats food 4. Score tracking system 5. Game over detection (hitting walls or self) 6. Restart functionality 7. Visual styling with a clean interface The game features: - A green snake that moves around the board - Red food that appears randomly - Score counter that increases by 10 points per food item - Game over screen with final score and restart button - Instructions for the player To play: 1. Use the arrow keys (↑, ↓, ←, →) to control the snake's direction 2. Try to eat the red food to grow and increase your score 3. Avoid hitting the walls or the snake's own body 4. When game over, click "Play Again" to restart The game is completely self-contained in one file with no external dependencies. All CSS is in a style tag and JavaScript is in a script tag as requested.