Asteroids · claude-sonnet-5.5
Output generated Cost / run $0.0750 Runtime 33.6s
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 · 9 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.
/tmp/job-yrUQJn/index.html (5844 bytes){"action":"reload"}Successfully wrote to /tmp/job-yrUQJn/index.html
Frame 1, +0ms
[Browser image supplied to model]
{"console":["warning: An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing."],"dom":"","images":"attached"}
Title works. Quick play test.
{"action":"key","text":"Enter"}{"action":"screenshot"}Frame 1, +0ms
[Browser image supplied to model]
{"console":["warning: An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing."],"dom":"","images":"attached"}
Frame 1, +0ms
[Browser image supplied to model]
{"console":["warning: An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing."],"dom":"","images":"attached"}
thinking
The rock count checks out for level 1, and the function reference looks fine too. I'm fairly confident this is ready to ship.
The Asteroids game is built in `/tmp/job-yrUQJn/index.html`. I only checked the title screen and the start of a game by screenshot. I didn't test shooting, splitting, scoring, collisions, game over or the level-clear message, so those are untested. The title screen shows drifting asteroids. Pressing Enter starts a game with the ship at the centre, 3 lives and 4 large asteroids. The browser console showed only a sandbox warning from the preview iframe and no script errors. **Controls:** left and right arrows (or A and D) rotate, up arrow (or W) thrusts, Space fires, and Enter starts or restarts. **Rules:** - **Ship and shots:** the ship and its bullets wrap around the screen edges. - **Asteroids:** large ones split into two medium, then two small. Scores are 20 for a large asteroid, 50 for a medium and 100 for a small. - **Lives:** the ship is invulnerable for a few seconds after each respawn. You get an extra life every 5,000 points. - **Levels and score:** clearing all asteroids starts a new level with one more asteroid. The high score is kept in `localStorage`. Everything is drawn procedurally as glowing vector lines, with no external assets.