oneshotlm
Compare all models on this prompt →

Snake · nex-n2-pro

Output generated Cost / run $0.0040 Runtime 25.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

modelnex-n2-pro
vendorNex AGI
harnesspi-agent
generated2026-08-01

METRICS

runtime25.4s
tokens in7.1k
tokens out3.8k
cached7.0k
cost / run$0.0040
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
We need respond by doing task. Need create index.html in cwd. Need inspect? Current directory /tmp/ws. Need build single page. No external. Need ensure playable Snake canvas arrow keys, growing tail, food, score, game-over restart. Need maybe include touch? User only arrow-key. Need write file. Need maybe use bash pwd? We know cwd. Need create file. Could use write. Need produce concise final. Need ensure file self-contained. Let's craft robust Snake game.

Need maybe include style tag, script tag. Need no external. Features:
- Canvas centered, high DPI scaling maybe.
- Grid 20x20, cell 24, canvas width 480 height 480.
- Snake array of segments, direction, pending direction.
- Food random not on snake.
- Score, best maybe localStorage? External? localStorage okay. But no network. Could include.
- Game states: running, over, maybe paused? Restart button.
- Arrow keys prevent scroll.
- Start maybe game starts immediately.
- On game over show overlay with restart button, Enter/Space.
- R restart.
- Use requestAnimationFrame with fixed tick 100ms.
- Canvas draw.
- Growing tail: only extend when eating.
- Edge collision or wrap? Need playable. We'll choose wall collision game over.
- Self collision.
- Food random.
- Score increments.
- Restart state.
- Need arrow-key controls. Prevent reverse direction if length >1.
- Could include "Click restart" and "Press R/Enter".

Need maybe if document hidden pause? Not necessary. But good.

Need write index.html. Need ensure no external.
→ write /tmp/ws/index.html (10127 bytes)
toolResult

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

assistant
thinking

Created `/tmp/ws/index.html` with a self-contained playable Snake game.