Snake · qwen3.5-plus-20260420
Output generated Cost / run $0.0088 Runtime 71.0s
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.
thinking
The user wants a Snake game built as a single HTML file with embedded CSS and JS. Let me build a complete, polished Snake game with: 1. Canvas-based rendering 2. Arrow key controls 3. Growing tail mechanic 4. Food spawning 5. Score tracking 6. Game over state (wall collision + self collision) 7. Restart functionality Let me write this all in one file.
/tmp/ws/index.html (9574 bytes)Successfully wrote 9574 bytes to /tmp/ws/index.html
The Snake game is ready at `/tmp/ws/index.html`. Here's what's included: **Gameplay:** - Classic snake mechanics on a 30×30 grid - Arrow keys + WASD controls - Food spawns randomly (avoiding the snake body) - Snake grows when eating food, score increases - Game over on wall collision or self-collision **Visual features:** - Dark themed UI with subtle grid lines - Gradient snake body (bright green head → darker tail) - Eyes on the snake head that follow the direction of movement - Glowing red food with radial glow effect - Red flash on game over **UI states:** - **Start screen** — title + instructions + "Start Game" button - **Playing** — score display in the header - **Game Over** — final score shown + "Play Again" button - High score persisted in `localStorage` **Restart:** Click the button, press Space, or press Enter.