oneshotlm
Compare all models on this prompt →

Space Invaders · muse-wonder

Output generated Cost / run $0.5090 Runtime 100.8s

Prompt for this run

Build a playable Space Invaders-style game on a canvas using procedural 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 or A/D to move a cannon along the bottom and Space to fire upward. Display the controls and keep the cannon within the playfield. - Start with a grid of aliens that moves horizontally, reverses and descends at the edges, and fires toward the player. Player shots remove hit aliens and increase score once. - Place destructible bunkers between the cannon and aliens. Hits from either side remove bunker material persistently; shots can subsequently pass through the resulting gaps. - Start with three lives. Enemy shots cost a life with brief protection from repeated damage. Aliens reaching the player zone or zero lives causes Game Over; clearing the aliens shows a win state. - Provide Restart to restore aliens, bunkers, score, lives, and player position. Bound projectile lifetime and fire rate. Verify: Test movement and firing during the opening formation. Check alien motion and inspect a shot hitting a bunker or alien for visible damage or score feedback. Use Restart and check the initial formation, bunkers, lives, and score.

⛨ 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

runtime100.8s
tokens in172k
tokens out9.3k
cached96k
cost / run$0.5090
Transcript · 23 messages
system

user

Build a playable Space Invaders-style game on a canvas using procedural 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 or A/D to move a cannon along the bottom and Space to fire upward. Display the controls and keep the cannon within the playfield. - Start with a grid of aliens that moves horizontally, reverses and descends at the edges, and fires toward the player. Player shots remove hit aliens and increase score once. - Place destructible bunkers between the cannon and aliens. Hits from either side remove bunker material persistently; shots can subsequently pass through the resulting gaps. - Start with three lives. Enemy shots cost a life with brief protection from repeated damage. Aliens reaching the player zone or zero lives causes Game Over; clearing the aliens shows a win state. - Provide Restart to restore aliens, bunkers, score, lives, and player position. Bound projectile lifetime and fire rate. Verify: Test movement and firing during the opening formation. Check alien motion and inspect a shot hitting a bunker or alien for visible damage or score feedback. Use Restart and check the initial formation, bunkers, lives, and score.

assistant
thinking
Implementing single-file Space Invaders with movement, shooting, collision, scoring, lives, destructible bunkers, and restart logic.
→ write index.html (20833 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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥♥\nALIENS LEFT\n55\nHI-SCORE\n0\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nDefend Earth! Clear all 55 invaders.\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥♥\nALIENS LEFT\n55\nHI-SCORE\n0\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nDefend Earth! Clear all 55 invaders.\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
thinking
→ browser {"action":"key","text":"Space"}
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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥\nALIENS LEFT\n55\nHI-SCORE\n0\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nHit! 2 lives left — brief shield active (2s).\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
thinking
→ browser {"action":"click","x":540,"y":710}
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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n10\nLIVES\n♥♥\nALIENS LEFT\n54\nHI-SCORE\n10\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nAlien destroyed +10 pts!\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
thinking
→ browser {"action":"key","text":"KeyR"}
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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥♥\nALIENS LEFT\n55\nHI-SCORE\n10\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nDefend Earth! Clear all 55 invaders.\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
thinking
→ browser {"action":"scroll","delta":400}
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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥\nALIENS LEFT\n55\nHI-SCORE\n10\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nHit! 2 lives left — brief shield active (2s).\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
thinking
→ browser {"action":"scroll","delta":300}
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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥\nALIENS LEFT\n55\nHI-SCORE\n10\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nHit! 1 life left — brief shield active (2s).\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
→ browser {"action":"click","x":273,"y":635}
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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥♥\nALIENS LEFT\n55\nHI-SCORE\n10\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nDefend Earth! Clear all 55 invaders.\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","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":"SPACE INVADERS\nPROCEDURAL CANVAS EDITION\nSCORE\n0\nLIVES\n♥♥♥\nALIENS LEFT\n55\nHI-SCORE\n0\n↻ RESTART\n⏸ PAUSE\n🔊 SOUND ON\nDefend Earth! Clear all 55 invaders.\n◀ ▶ or A / D Move\nSPACE Fire\nP Pause\nR Restart\nENTER Start / Restart\n👾 Top row = 30 pts\n🛸 Middle = 20 pts\n👽 Bottom = 10 pts\n🧱 Bunkers erode from both sides\nNO EXTERNAL ASSETS · ALL SPRITES DRAWN IN CODE · BUNKERS ARE DESTRUCTIBLE PIXEL-BY-PIXEL","images":"attached"}

assistant
thinking

Built a complete playable Space Invaders game in a single self-contained `index.html` — no external assets, CDNs, or libraries. All sprites (3 alien types, cannon, bunkers, starfield) are drawn procedurally on an 800×600 canvas. **Features implemented:** - **Controls displayed on-page:** ◀/▶ or A/D to move (clamped to the playfield), Space to fire, plus P pause, R restart, Enter, and touch buttons on mobile - **Alien formation:** 5×11 grid that marches horizontally, reverses and descends 18px at the edges, speeds up as aliens are destroyed, and fires aimed shots from the bottom alien of random columns - **Scoring:** 30/20/10 points by row, awarded once per alien, with floating "+pts" feedback, explosions, hi-score, and aliens-remaining counter - **Destructible bunkers:** 4 bunkers on a per-cell grid; shots from *both* sides blast out material persistently, and later shots pass through the holes - **Lives:** 3 lives, enemy hits trigger a 2-second shield (visible ring + blinking) that absorbs repeat damage; Game Over on zero lives or aliens reaching the cannon line; win state on clearing all 55 - **Restart button** (and R/Enter) fully resets aliens, bunkers, score, lives, and player position - **Bounded projectiles:** 220ms fire-rate cooldown, max 3 player / 6 enemy shots, and max-age/off-screen cleanup **Verified in the browser:** - Initial render: full 55-alien formation, 4 intact bunkers, cannon centered, score 0, 3 lives — no console errors - Alien formation visibly marched sideways; enemy fire eroded a bunker (visible notch) - Space fired a visible upward shot; that shot later destroyed an alien (**+10 pts, 55→54 aliens**) - Enemy hit cost a life (3→2, then 1) with the shield ring appearing and message shown - Restart (both the button and R key) restored score 0, 3 lives, 55 aliens, pristine bunkers, and centered cannon **Not fully verified:** complete win and game-over playthroughs (would require clearing/reaching the bottom over several minutes) — those code paths are implemented but were not played to completion in the test pass.