oneshotlm
Compare all models on this prompt →

Snake · minimax-m2

Output generated Cost / run $0.0057 Runtime 28.1s

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

modelminimax-m2
vendorMiniMax
harnesspi-agent
generated2026-08-01

METRICS

runtime28.1s
tokens in10k
tokens out3.1k
cached0
cost / run$0.0057
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 - a classic arcade game where a snake moves around eating food, growing longer, and avoiding collisions with itself and walls. Let me create a single HTML file with all the CSS and JavaScript inline.

Key features needed:
1. Canvas-based rendering
2. Arrow key controls
3. Snake with growing tail
4. Food generation
5. Score tracking
6. Game over state
7. Restart functionality

Let me build this step by step in a single self-contained HTML file.
→ write /tmp/ws/index.html (10519 bytes)
toolResult

Successfully wrote 10519 bytes to /tmp/ws/index.html

assistant
thinking
The Snake game has been created. Let me verify the file exists and summarize what was built.
→ bash {"command":"ls -la /tmp/ws/index.html"}
toolResult

-rw-r--r--. 1 node node 10519 Aug 1 20:45 /tmp/ws/index.html

assistant
thinking
The file has been created successfully. Let me provide a summary of what was built.

Done! I've created a fully functional Snake game in `/tmp/ws/index.html`. Here's what's included: **Features:** - 🎮 **Arrow key controls** - Move the snake in 4 directions - 🐍 **Growing tail** - Snake grows when eating food - 🍎 **Food** - Randomly spawned, glowing red apple - 📊 **Score tracking** - Current score and persistent high score (saved to localStorage) - ⚠️ **Game over** - When hitting walls or self-collision - 🔄 **Restart** - "Play Again" button on game over - ⏸️ **Pause** - Press Space to pause/resume **Visual Design:** - Dark cyberpunk/neon aesthetic with glowing effects - Gradient snake body that fades toward the tail - Grid background for retro feel - Pulsing food with glow effect - Smooth animations and hover effects on buttons **Game Mechanics:** - 20x20 grid canvas - 100ms game speed - Cannot reverse direction directly (prevents instant death) - Collision detection for walls and self