Snake · nex-n2-pro
Build a playable Snake game on a canvas with arrow-key controls, a growing tail, food, score, and a game-over and restart state.
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.
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.
/tmp/ws/index.html (10127 bytes)Successfully wrote 10127 bytes to /tmp/ws/index.html
thinking
Created `/tmp/ws/index.html` with a self-contained playable Snake game.
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
EVALUATION
Snake starts on Enter/Space but arrow/WASD presses just crash it back to Game Over without visible movement.
Vision grade · anthropic/claude-sonnet-5
MEASUREMENTS
Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.