Snake · hy3-preview
Output generated Cost / run $0.0009 Runtime 31.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.
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.
I'll create a complete Snake game as a single self-contained HTML file with all the requested features.
/workspace/index.html (9001 bytes)Successfully wrote 9001 bytes to /workspace/index.html
The Snake game has been built and saved to `index.html`. Here's what's included: **Features:** - **Canvas-based gameplay** with a 400x400 pixel play area - **Arrow key controls** (also supports WASD) - **Growing tail** - snake grows when eating food - **Food spawning** with collision detection to avoid spawning on the snake - **Score tracking** with points for each food eaten - **High score** saved to localStorage - **Game over screen** with final score display - **Restart button** to play again **Visual Details:** - Neon green snake with gradient body and eyes on the head - Red glowing food with pulsing animation - Dark background with subtle grid lines - Snake eyes that change direction based on movement - Increasing speed as score goes up (every 50 points) **Game Mechanics:** - Snake cannot reverse direction (prevents instant death) - Wall and self-collision end the game - Speed increases gradually to increase difficulty Open `index.html` in a browser to play!