Asteroids · claude-opus-4.8
Output generated Cost / run $0.3049 Runtime 82.0s
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.
I'll build a complete Asteroids game in a single self-contained index.html file.
/workspace/index.html (13899 bytes)Successfully wrote 13899 bytes to /workspace/index.html
thinking
I'm checking whether reassigning the `update` function after its declaration works in strict mode—it does, since function declarations can be reassigned even in strict mode. Let me run through the syntax to make sure everything checks out.
{"command":"cd /workspace && node --check <(sed -n '/<script>/,/<\\/script>/p' index.html | sed '1d;$d') 2>&1 | head; echo \"checked\""}node:fs:441 return binding.readFileUtf8(path, stringToFlags(options.flag)); ^ Error: ENOENT: no such file or directory, open '/proc/19/fd/pipe:[31961]' at Object.readFileSync (node:fs:441:20) at node:internal/main/check_syntax:36:21 { errno: -2, code: 'ENOENT', syscall: 'open', checked
{"command":"cd /workspace && sed -n '/<script>/,/<\\/script>/p' index.html | sed '1d;$d' > /tmp/g.js && node --check /tmp/g.js && echo \"SYNSYNTAX OK
The game is complete and syntax-checked. `index.html` is a fully self-contained Asteroids game with no external resources. Features implemented: - **Vector ship** with rotate (←/→), thrust (↑) with flame + friction, and screen wrapping - **Shooting** (Space) with cooldown, bullet limit, recoil, and lifetime - **Asteroids** as procedurally generated jagged polygons that split into two smaller pieces when hit (large → medium → small), each drifting and spinning with wraparound - **Score** (100/50/20 by size) and **lives** shown as ship icons, plus best score and level tracking - **Level progression** — clearing all asteroids spawns a harder wave - **Particle explosions** for hits and thrust, spawn invulnerability with blinking, respawn delay - **States**: title screen (with drifting asteroids), playing, pause (P), death respawn, and game over — Enter to start/restart Open `index.html` in a browser and press Enter to play.