oneshotlm
Compare all models on this prompt →

Snake · gemini-3.1-flash-lite

Output generated Cost / run $0.0036 Runtime 9.5s

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

modelgemini-3.1-flash-lite
vendorGoogle
harnesspi-agent
generated2026-07-22

METRICS

runtime9.5s
tokens in4.0k
tokens out1.7k
cached0
cost / run$0.0036
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
**Developing Core Game Mechanics**

I'm currently focusing on implementing the fundamental elements for the Snake game. This involves setting up the canvas for rendering, establishing arrow key input for snake movement, and coding the logic for the snake's tail to grow as it consumes food. The food generation mechanism is also a key area of progress.

→ write index.html (4173 bytes)
toolResult

Successfully wrote 4173 bytes to index.html

assistant

The Snake game has been created in `index.html`. You can open this file in any web browser to play. **Features included:** * **Canvas rendering:** Smooth grid-based movement. * **Arrow key controls:** Responsive inputs with logic to prevent accidental self-collision (preventing 180-degree turns). * **Growing tail:** Snake increases in length when food is consumed. * **Food spawning:** Food appears at random locations. * **Score tracking:** Updates live as the snake eats. * **Game-over logic:** Detects wall hits and self-collisions. * **Restart functionality:** Resets the game state without refreshing the page.