oneshotlm
Compare all models on this prompt →

Snake · gpt-oss-20b

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 ↗
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 to write single-page web app index.html. Must create file with HTML, CSS, JS. Use canvas, arrow key controls. Game logic: snake moves in grid, grows on eating food. Detect collision with walls or self -> game over. Score increments. Provide restart button after game over.

We'll write file using write function.

Let's craft index.html content.

Design:

- <canvas id="gameCanvas" width="400" height="400"></canvas>
- <div id="score">Score: 0</div>
- <div id="gameOver" style="display:none;">Game Over! <button id="restartBtn">Restart</button></div>

JS: use window.onload to init.

Set grid size, e.g., cellSize 20, so grid 20x20.

Snake array of positions: [{x, y}]. Initial length 3.

Direction: {dx, dy}, default right.

Set interval to update every 100ms.

Keydown event to change direction if not opposite.

Generate food at random empty cell.

Move snake: add new head = {x+dx, y+dy}. If new head collides with walls or self: game over.

If new head equals food: increase score, generate new food; don't pop tail.

Else: pop tail.

Render: clear canvas, fill each cell of snake with color, food with red.

Game over: clear interval, show gameOver div, hide canvas? Keep canvas.

Restart: reset state, hide gameOver, start interval.

Also allow pressing space or similar.

Implement as all in one file.

Let's prepare content string.

We'll write using write tool.

write index.html (3514 bytes)
toolResult

Successfully wrote 3514 bytes to index.html

assistant

The `index.html` file has been created in the current directory. It contains a self‑contained Snake game with arrow‑key controls, growing tail, food, score tracking, and a game‑over/restart interface. You can open this file in a web browser to play the 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

modelgpt-oss-20b
vendorOpenAI
harnesspi-agent
generated2026-07-22

EVALUATION

1/5 broken

Stuck on Game Over screen with static snake and food, no response to any input including restart clicks.

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.

idle motion0.0%
on click0.0%
on drag0.0%
on wheel0.0%
on enter + space0.0%
on arrow keys0.0%
on w/a/s/d0.0%
frame spread13.3 / 255
console errors0
js errors none

METRICS

runtime21.2s
tokens in4.0k
tokens out1.7k
cached0
cost / run$0.0003