Snake · gemma-4-26b-a4b-it
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
The user wants a playable Snake game in a single `index.html` file.
The game needs:
- Canvas-based rendering.
- Arrow-key controls.
- A growing tail.
- Food.
- Score tracking.
- Game-over and restart state.
- No external resources (pure HTML/CSS/JS).
Plan:
1. Create an `index.html` file.
2. Add a `<canvas>` element.
3. Add CSS for styling (centering the canvas, basic game UI).
4. Add JavaScript for:
- Game loop (using `requestAnimationFrame` or `setTimeout`).
- Snake movement and growth.
- Food generation.
- Collision detection (walls and self).
- Score management.
- Keyboard input handling.
- Game state management (playing, game over).
Implementation details:
- Grid-based movement.
- Snake as an array of coordinates.
- Food as a single coordinate.
- Canvas size should be fixed (e.g., 400x400).
- Cell size (e.g., 20px).
Let's write the code.index.html (7657 bytes)Successfully wrote 7657 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
Game shows Game Over immediately with score 0 and never responds 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.