Asteroids · minimax-m2
Output generated Cost / run $0.0094 Runtime 45.8s
Prompt for this run
Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.
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
METRICS
Transcript · 8 messages
Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.
thinking
The user wants me to build a complete Asteroids game in a single HTML file. Let me plan this out: 1. **Game Mechanics:** - Ship that rotates and thrusts (vector-based movement) - Shooting bullets - Asteroids that split into smaller pieces when hit - Screen wrapping on all edges - Score system - Lives system 2. **Graphics:** - Procedural vector graphics (drawing with canvas paths) - No external assets 3. **Controls:** - Arrow keys for rotation and thrust - Space to shoot Let me build this step by step in a single index.html file.
/tmp/ws/index.html (17110 bytes)Successfully wrote 17110 bytes to /tmp/ws/index.html
thinking
I've created the Asteroids game. Let me verify it was created correctly and check if there are any issues.
{"command":"ls -la /tmp/ws/index.html"}-rw-r--r--. 1 node node 17110 Aug 1 19:44 /tmp/ws/index.html
thinking
The file was created successfully. Let me verify the HTML syntax is correct by checking for any obvious issues.
{"command":"head -50 /tmp/ws/index.html && echo \"...\" && tail -20 /tmp/ws/index.html"}<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Asteroids</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { background: #0a0a0f; display: flex; justify-content: center; align-items: center; min-height: 100vh; font-family: 'Courier New', monospace; overflow: hidden; } #gameContainer { position: relative; } canvas { display: block; border: 2px solid #00ff88; box-shadow: 0 0 20px rgba(0, 255, 136, 0.3); } #ui { position: absolute; top: 10px; left: 10px; color: #00ff88; font-size: 18px; text-shadow: 0 0 5px #00ff88; } #lives { position: absolute; top: 10px; right: 10px; color: #00ff88; font-size: 18px; text-shadow: 0 0 5px #00ff88; } #gameOver { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); ... if (canFire) { bullets.push(createBullet()); } } } e.preventDefault(); }); document.addEventListener('keyup', (e) => { if (e.code === 'ArrowLeft') keys.left = false; if (e.code === 'ArrowRight') keys.right = false; if (e.code === 'ArrowUp') keys.up = false; if (e.code === 'Space') keys.space = false; }); // Start the game loop gameLoop(); </script> </body> </html>
thinking
The file looks good. It has proper HTML structure with opening and closing tags. The game is complete with: 1. **Ship controls**: Arrow keys for rotation (left/right) and thrust (up), space for shooting 2. **Vector movement**: Physics-based with friction for realistic feel 3. **Screen wrapping**: All objects wrap around screen edges 4. **Asteroids**: Procedurally generated with irregular shapes, split into smaller pieces when hit 5. **Scoring**: Points based on asteroid size (smaller = more points) 6. **Lives**: 3 lives with visual ship display and invulnerability on respawn 7. **Visual effects**: Particle explosions, thrust flames, trail effect 8. **Game states**: Start screen, playing, game over with restart All in a single self-contained HTML file with no external dependencies.
The Asteroids game is complete. Here's what's included: **Controls:** - **Arrow Left/Right** - Rotate ship - **Arrow Up** - Thrust - **Space** - Shoot / Start / Restart **Features:** - Vector-style ship with thrust flame effect - Procedurally generated asteroids with irregular shapes (3 sizes) - Asteroids split into 2 smaller pieces when destroyed - Screen wrapping on all edges - Physics-based movement with friction - Particle explosion effects on destruction - Score system (20/30/50 points for large/medium/small asteroids) - 3 lives with invulnerability on respawn - Progressive difficulty (more asteroids each level) - Start screen and game over screen - Retro neon visual style with glow effects Open `/tmp/ws/index.html` in a browser to play!