Snake · gpt-oss-120b
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 to create index.html with canvas snake game. Use single file, all CSS/JS inline. We'll write the file. We need to create index.html in workspace. We'll write content. The code: HTML boilerplate, style for body center, canvas border. JS: set up canvas, context, game variables: grid size, snake as array of segments, direction, food, score. Game loop using setInterval 100ms. Handle keydown for arrow keys; prevent reverse direction. Update snake position, grow when eats, collision detection (wall or self). Game over: stop loop, show overlay text and restart button. On restart, reset variables. Implement drawing: clear canvas, draw food (red square), draw snake (green squares), draw score. We can embed everything. Let's write the file via write tool.
index.html (4300 bytes)Successfully wrote 4300 bytes to index.html
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 game starts already game-over with score 0; no input restarts or moves the snake.
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.