oneshotlm
Compare all models on this prompt →

Snake · qwen3.6-27b

Output generated Cost / run $0.0149 Runtime 77.2s

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.

⛨ sandboxed Open in new tab ↗

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

modelqwen3.6-27b
vendorQwen
harnesspi-agent
generated2026-07-31

METRICS

runtime77.2s
tokens in12k
tokens out4.0k
cached4.4k
cost / run$0.0149
Transcript · 6 messages
user

Build a playable Snake game on a canvas with arrow-key controls, a growing tail, food, score, and a game-over and restart state.

assistant
thinking
The user wants a self-contained Snake game in a single HTML file. Let me build a complete, playable Snake game with:
- Canvas-based rendering
- Arrow key controls
- Growing tail when eating food
- Score display
- Game over state (collision with walls or self)
- Restart functionality

Let me write this all in one index.html file with inline CSS and JS.
→ write /workspace/index.html (10348 bytes)
toolResult

Successfully wrote 10348 bytes to /workspace/index.html

assistant
thinking
The file has been written. Let me verify it exists and is complete.

→ bash {"command":"head -5 /workspace/index.html && echo \"---\" && tail -5 /workspace/index.html && echo \"---\" && wc -l /workspace/index.html"}
toolResult

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> --- requestAnimationFrame(loop); })(); </script> </body> </html>--- 371 /workspace/index.html

assistant
thinking
The file is complete and valid. Let me summarize what was built.

Done. `/workspace/index.html` is a fully self-contained Snake game with: - **Canvas rendering** on a 30×25 grid with subtle grid lines and rounded rects - **Arrow-key controls** (also supports WASD) - **Growing tail** — the snake lengthens each time food is eaten - **Food** — randomly placed with a glow effect, never spawns on the snake - **Score + Best** — live score counter; best score persisted in `localStorage` - **Speed ramp** — game gets slightly faster every 5 points - **Game over** — on wall or self-collision, with an overlay showing final score - **Restart** — press Enter/Space/tap after game over to replay - **Touch/swipe support** — swipe on the canvas to steer on mobile - **Visual polish** — gradient snake body, glowing head with eyes, neon green-on-dark aesthetic