oneshotlm
Compare all models on this prompt →

Snake · qwen3.5-122b-a10b

Output generated Cost / run $0.0114 Runtime 26.7s

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.5-122b-a10b
vendorQwen
harnesspi-agent
generated2026-08-01

METRICS

runtime26.7s
tokens in12k
tokens out4.0k
cached0
cost / run$0.0114
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 me to build a Snake game as a single-page web app in one self-contained index.html file. Let me create this with:

1. Canvas for rendering the game
2. Arrow key controls for movement
3. Snake that grows when eating food
4. Food spawning randomly
5. Score tracking
6. Game-over state when snake hits wall or itself
7. Restart functionality

I'll write all CSS and JavaScript inline within the HTML file.
→ write index.html (13520 bytes)
toolResult

Successfully wrote 13520 bytes to index.html

assistant
thinking
The file has been created successfully. Let me verify it exists and is complete.
→ bash {"command":"ls -la index.html"}
toolResult

-rw-r--r--. 1 node node 13530 Aug 1 20:44 index.html

assistant
thinking
The file has been created successfully. The Snake game is complete with:
- Canvas-based rendering (500x500 pixels, 20x20 grid)
- Arrow key controls for movement
- Snake that grows when eating food
- Random food spawning
- Score tracking with high score persistence
- Game-over state when hitting walls or self
- Restart functionality via button
- Visual effects like gradients, shadows, and snake eyes

The game runs fully sandboxed with no external resources.

Snake game created! The `index.html` file contains: **Features:** - 🎮 **Canvas rendering** - 500x500px game board with 20x20 grid - ⬆️⬇️⬅️➡️ **Arrow-key controls** - Smooth directional input with anti-reverse logic - 🐍 **Growing tail** - Snake extends by 1 segment each time food is eaten - 🍎 **Food spawning** - Red circular food appears at random valid positions - 📊 **Score system** - Current score + persistent high score display - 💀 **Game-over state** - Triggers on wall collision or self-collision - 🔄 **Restart** - "Play Again" button to restart after game over - ✨ **Visual polish** - Gradients, glow effects, snake eyes that follow direction Open `index.html` in a browser to play!