Snake · deepseek-v4-flash
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 · 6 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
The user wants me to build a complete Snake game in a single HTML file. Let me create a well-designed, playable Snake game with all the requested features.
/workspace/index.html (17166 bytes)Successfully wrote 17166 bytes to /workspace/index.html
thinking
The file has been written. Let me verify it exists and check its size.
{"command":"ls -la /workspace/index.html && wc -l /workspace/index.html"}-rw-r--r-- 1 node node 17178 Jul 8 00:46 /workspace/index.html 646 /workspace/index.html
thinking
The file is created successfully. Let me verify it's a proper HTML file by checking the structure.
The file is ready at `/workspace/index.html` (646 lines, ~17KB). Here's what it includes: **Features:** - **Canvas-based Snake** on a 20×20 grid with smooth rendering - **Arrow-key controls** — press any arrow to start, and the game begins moving - **Growing tail** — each food eaten adds one segment; the snake grows and the body color gradients from head to tail - **Food** — randomly placed, pulses with a glowing animation, never spawns on the snake - **Score** — displayed at the top, with high score saved to `localStorage` across sessions - **Game over** — on wall collision or self-collision, a dark overlay appears with "GAME OVER" (or "YOU WIN!" if you fill the entire board) - **Restart** — click the "New Game" button or press any arrow key to restart after game over - **Touch/swipe support** — swipe on the canvas to control direction on mobile - **No external dependencies** — pure HTML/CSS/JS, no network requests, no CDNs
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 responds to arrow keys, moved snake and hit game over quickly; WASD had no effect as expected.
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.