oneshotlm
Compare all models on this prompt →

Snake · glm-5

Output generated Cost / run $0.0086 Runtime 49.4s

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

modelglm-5
vendorZ.ai · GLM
harnesspi-agent
generated2026-07-22

METRICS

runtime49.4s
tokens in6.1k
tokens out3.4k
cached2.9k
cost / run$0.0086
Transcript · 4 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 with the following features:
1. Canvas-based rendering
2. Arrow key controls
3. Growing tail when eating food
4. Food spawning
5. Score tracking
6. Game-over state
7. Restart functionality

I'll create a single index.html file with all the HTML, CSS, and JavaScript inline. Let me build this game.
→ write /workspace/index.html (13428 bytes)
toolResult

Successfully wrote 13428 bytes to /workspace/index.html

assistant
thinking
I've created a complete Snake game. Let me verify the file was created correctly by reading it.

I've created a complete Snake game in `/workspace/index.html`. Here's what's included: **Features:** - 🎮 **Arrow key controls** - Move the snake with Up/Down/Left/Right arrows - 🐍 **Growing tail** - Snake grows each time it eats food - 🍎 **Food spawning** - Red glowing food appears at random positions (never on the snake) - 📊 **Score tracking** - 10 points per food eaten, displayed at the top - 💀 **Game Over state** - Triggers when hitting walls or yourself - 🔄 **Restart functionality** - Click "Play Again" button to restart - 👀 **Snake eyes** - The head has eyes that follow the direction of movement - ⚡ **Speed increase** - Game speeds up every 50 points **Visual polish:** - Dark themed canvas with subtle grid - Glowing effects on the snake head and food - Gradient color snake body with alternating shades - Rounded corners on snake segments - Beautiful game over overlay with score display Just open `index.html` in any browser to play!