oneshotlm
Compare all models on this prompt →

Asteroids · muse-wonder

Output generated Cost / run $0.3072 Runtime 99.4s

Prompt for this run

Build a playable Asteroids-style game on a canvas using procedural vector graphics. Use HTML, CSS, and JavaScript as needed. Write it to `index.html` in the current working directory using your file tools. Inline your own CSS and JavaScript. Do not use external assets, CDNs, or network requests. No third-party libraries are provided. Required behavior: - Use Left/Right to rotate the ship, Up to thrust, and Space to fire. Show the controls. The ship retains momentum and wraps around every screen edge; asteroids also wrap. - Spawn moving large asteroids. A bullet hit splits a large asteroid into smaller pieces; hitting a smallest piece removes it. Hits increase the score. - Start with three lives. A ship-asteroid collision removes one life, respawns the ship, and briefly protects it from immediate repeated damage. - Clearing all asteroids starts another wave. Losing all lives shows Game Over and a Restart control that resets score, lives, and the arena. - Keep projectile lifetime bounded and prevent gameplay keys from scrolling the page. Verify: Test rotation, thrust, and firing near the initial spawn. Check that the ship changes heading, gains momentum, and emits moving projectiles. Sample the scene to inspect screen wrapping when an object crosses an edge.

⛨ sandboxed Open in new tab ↗

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

modelmuse-wonder
vendorMeta
harnesspi 0.87.1 · browser iteration
generated2026-10-15

METRICS

runtime99.4s
tokens in97k
tokens out8.6k
cached67k
cost / run$0.3072
Transcript · 17 messages
system

user

Build a playable Asteroids-style game on a canvas using procedural vector graphics. Use HTML, CSS, and JavaScript as needed. Write it to `index.html` in the current working directory using your file tools. Inline your own CSS and JavaScript. Do not use external assets, CDNs, or network requests. No third-party libraries are provided. Required behavior: - Use Left/Right to rotate the ship, Up to thrust, and Space to fire. Show the controls. The ship retains momentum and wraps around every screen edge; asteroids also wrap. - Spawn moving large asteroids. A bullet hit splits a large asteroid into smaller pieces; hitting a smallest piece removes it. Hits increase the score. - Start with three lives. A ship-asteroid collision removes one life, respawns the ship, and briefly protects it from immediate repeated damage. - Clearing all asteroids starts another wave. Losing all lives shows Game Over and a Restart control that resets score, lives, and the arena. - Keep projectile lifetime bounded and prevent gameplay keys from scrolling the page. Verify: Test rotation, thrust, and firing near the initial spawn. Check that the ship changes heading, gains momentum, and emits moving projectiles. Sample the scene to inspect screen wrapping when an object crosses an edge.

assistant
thinking
Implementing canvas asteroids game with rotation, thrust, wrapping, collision, scoring, lives, waves, and bounded projectiles while preventing key scroll.Adding asteroid splitting, invulnerability, wave scaling, particles, and pause with responsive canvas and input handling.
→ write index.html (19286 bytes)
toolResult

Successfully wrote to index.html

assistant
thinking
→ browser {"action":"inspect"}
toolResult

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":"ASTEROIDS\n\nPROCEDURAL VECTOR COMMAND\n\nSCORE\n0\nWAVE\n1\nLIVES\n▲ ▲ ▲\nWAVE 1 — 5 ASTEROIDS INBOUND\nWAVE 1\n\nCLEAR ALL ASTEROIDS\n\n◀ LEFT  rotate left\n▶ RIGHT  rotate right\n▲ UP  thrust\nSPACE  fire\nP  pause\n❚❚ PAUSE\n♪ SOUND ON","images":"attached"}

assistant
thinking
→ browser {"action":"key","text":"ArrowRight"}
toolResult

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":"ASTEROIDS\n\nPROCEDURAL VECTOR COMMAND\n\nSCORE\n0\nWAVE\n1\nLIVES\n▲ ▲ ▲\nWAVE 1 — 5 ASTEROIDS INBOUND\nWAVE 1\n\nCLEAR ALL ASTEROIDS\n\n◀ LEFT  rotate left\n▶ RIGHT  rotate right\n▲ UP  thrust\nSPACE  fire\nP  pause\n❚❚ PAUSE\n♪ SOUND ON","images":"attached"}

assistant
thinking
→ browser {"action":"key","text":" "}
toolResult

Frame 1, +1ms

[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":"ASTEROIDS\n\nPROCEDURAL VECTOR COMMAND\n\nSCORE\n0\nWAVE\n1\nLIVES\n▲ ▲\nSHIP LOST — 2 LIVES LEFT\nWAVE 1\n\nCLEAR ALL ASTEROIDS\n\n◀ LEFT  rotate left\n▶ RIGHT  rotate right\n▲ UP  thrust\nSPACE  fire\nP  pause\n❚❚ PAUSE\n♪ SOUND ON","images":"attached"}

assistant
thinking
→ browser {"action":"reload"}
toolResult

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":"ASTEROIDS\n\nPROCEDURAL VECTOR COMMAND\n\nSCORE\n0\nWAVE\n1\nLIVES\n▲ ▲ ▲\nWAVE 1 — 5 ASTEROIDS INBOUND\nWAVE 1\n\nCLEAR ALL ASTEROIDS\n\n◀ LEFT  rotate left\n▶ RIGHT  rotate right\n▲ UP  thrust\nSPACE  fire\nP  pause\n❚❚ PAUSE\n♪ SOUND ON","images":"attached"}

assistant
thinking
→ browser {"action":"key","text":"ArrowUp"}
toolResult

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":"ASTEROIDS\n\nPROCEDURAL VECTOR COMMAND\n\nSCORE\n0\nWAVE\n1\nLIVES\n▲ ▲ ▲\nWAVE 1 — 5 ASTEROIDS INBOUND\nWAVE 1\n\nCLEAR ALL ASTEROIDS\n\n◀ LEFT  rotate left\n▶ RIGHT  rotate right\n▲ UP  thrust\nSPACE  fire\nP  pause\n❚❚ PAUSE\n♪ SOUND ON","images":"attached"}

assistant
thinking
Analyzing ship position and asteroid wrapping to distinguish tester keypress timing from actual game movement.
→ bash {"command":"ls -lh index.html && grep -n \"ArrowLeft\\|ArrowUp\\|wrap(obj\\|level===1?20\\|invulnTimer = 3\\|life: 0.9\\|preventDefault\" in
toolResult

-rw-r--r-- 1 node node 19K Oct 15 04:05 index.html 132: function wrap(obj){ 171: invulnTimer = 3; // brief protection after respawn 215: life: 0.9, maxLife: 0.9 // bounded projectile lifetime 222: const gained = a.level===1?20 : a.level===2?50 : 100; 269: if(keys['ArrowLeft']) ship.angle -= ROT*dt; 273: ship.thrusting = !!keys['ArrowUp']; 398: const GAME_KEYS = ['ArrowLeft','ArrowRight','ArrowUp','ArrowDown',' ']; 400: if(GAME_KEYS.includes(e.key)) e.preventDefault(); 407: window.addEventListener('keyup', e=>{ if(GAME_KEYS.includes(e.key)) e.preventDefault(); keys[e.key]=false; }); 415: canvas.addEventListener('touchstart', e=>{ e.preventDefault(); }, {passive:false}); 0

assistant
thinking

Built a complete playable Asteroids game in a single self-contained `index.html` (19KB, no external assets/CDNs). **Features implemented:** - **Controls displayed on-screen:** ◀/▶ rotate, ▲ thrust, Space fire, P pause — all gameplay keys `preventDefault()`ed to stop page scrolling - **Ship physics:** momentum-retaining thrust (only ~0.5%/frame drag), rotation at 3.6 rad/s, thrust flame + exhaust particles, and wrap-around on all edges via a shared `wrap()` applied to ship, asteroids, and bullets - **Asteroids:** procedurally generated irregular vector polygons (large → 2 medium → 2 small → destroyed), scoring 20/50/100 by size, with spin and random velocities - **Lives/respawn:** 3 lives, collision costs a life, ship respawns at center with 3s blinking invulnerability shield; losing all lives shows a Game Over panel with a Restart button (also R/Enter) that resets score, lives, and wave - **Waves:** clearing all asteroids advances the wave with increasing asteroid counts and a wave banner - **Extras:** bounded bullet lifetime (0.9s with cooldown), particle explosions, screen shake, procedural starfield, HUD (score/wave/lives), pause and sound toggle, and a `window.__game` handle for inspection **Verified in the browser:** - Initial render: ship at center spawn, 5 large asteroids, HUD showing Score 0 / Wave 1 / 3 lives, controls bar visible, no console errors - Firing: pressing Space emitted a visible moving projectile from the ship's nose - Collision/lives: a ship–asteroid collision dropped lives 3 → 2, respawned the ship with the protective shield ring shown - Edge wrapping: screenshots captured asteroids partially crossing the top and left screen edges (mid-wrap) and re-entering, confirming wrap behavior **Not fully verified:** sustained rotation/thrust holds (the browser tool sends instantaneous key taps, so heading/momentum change was too small to visually confirm, though the polled-key logic is in place), bullet-split scoring chains, wave-clear progression, and the full Game Over → Restart flow were not driven to completion in the browser session.