Snake · glm-5.2
Output generated Cost / run $0.0120 Runtime 65.9s
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
Let me build a self-contained Snake game in index.html.
/workspace/index.html (8549 bytes)Successfully wrote 8549 bytes to /workspace/index.html
Done. `index.html` is a self-contained Snake game with everything inline (no external resources, no network). Features: - **Canvas grid** (20×20 cells) with rounded snake segments and a food apple - **Controls**: Arrow keys or WASD to steer, `P` to pause, plus swipe support for touch - **Growing tail**: each food eaten adds a segment (popped only when not eating) - **Score & best**: live HUD, best saved to `localStorage` - **Speed-up**: snake gets slightly faster as you score - **Game over**: wall or self collision shows an overlay with a **Restart** button; includes a paused state too Open `index.html` in any browser and hit Play.