Snake · qwen3-30b-a3b-instruct-2507
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.
I'll create a complete Snake game in a single HTML file with embedded CSS and JavaScript. The game will have all the requested features: arrow key controls, growing tail, food, score tracking, game over detection, and restart functionality.
index.html (8170 bytes)Successfully wrote 8170 bytes to index.html
I've created a complete Snake game in a single HTML file with all required features: - Canvas-based graphics with a 400x400 pixel playing field - Arrow key controls for movement (up, down, left, right) - Snake grows longer when eating food - Score tracking that increases with each food eaten - Game over detection when hitting walls or self - Restart functionality with the "Restart Game" button - Clean, responsive design with visual feedback The game is self-contained with no external dependencies - all CSS and JavaScript are embedded directly in the HTML file. The snake moves at a steady pace with the game loop running every 150ms, and the food appears randomly on the grid. When the game ends, the player can restart with the button.
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.