oneshotlm
Compare all models on this prompt →

Space Invaders · claude-sonnet-5.5

Output generated Cost / run $0.1069 Runtime 51.5s

Prompt for this run

Build a playable Space Invaders game on a canvas: a player cannon that moves and shoots, a descending grid of aliens that advance and fire back, destructible bunkers, score, and lives. Procedural graphics only, no external assets.

⛨ 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

modelclaude-sonnet-5.5
vendorAnthropic · Claude
harnesspi 0.87.1 · browser iteration
generated2026-10-05

METRICS

runtime51.5s
tokens in43k
tokens out5.3k
cached21k
cost / run$0.1069
Transcript · 12 messages
system

user

Build a playable Space Invaders game on a canvas: a player cannon that moves and shoots, a descending grid of aliens that advance and fire back, destructible bunkers, score, and lives. Procedural graphics only, no external assets.

assistant
→ write /tmp/job-Zb8ebY/index.html (7376 bytes)
→ browser {"action":"reload"}
toolResult

Successfully wrote to /tmp/job-Zb8ebY/index.html

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":"←/→ or A/D move · SPACE shoot · Enter start/restart · P pause","images":"attached"}

assistant
thinking
The lives display shows one fewer icon than actual lives since one is reserved, so with 3 lives it'll show 2 icons—that seems fine. Let me test the gameplay quickly.
→ browser {"action":"key","text":"Enter"}
→ browser {"action":"key","text":"Space"}
→ browser {"action":"screenshot"}
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":"←/→ or A/D move · SPACE shoot · Enter start/restart · P pause","images":"attached"}

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":"←/→ or A/D move · SPACE shoot · Enter start/restart · P pause","images":"attached"}

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":"←/→ or A/D move · SPACE shoot · Enter start/restart · P pause","images":"attached"}

assistant
thinking
The game doesn't seem to be advancing between screenshots—the aliens aren't moving, which makes me wonder if the screenshots are just instant frame grabs. Lives display shows 2 icons for 3 lives which seems fine, and key events are likely instantaneous keydown+keyup pairs, so I should test with actual motion.
→ browser {"action":"motion"}
toolResult

Frame 1, +0ms

[Browser image supplied to model]

Frame 2, +587ms

[Browser image supplied to model]

Frame 3, +1172ms

[Browser image supplied to model]

Frame 4, +1786ms

[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":"←/→ or A/D move · SPACE shoot · Enter start/restart · P pause","images":"attached"}

assistant

I've built the game in `/tmp/job-Zb8ebY/index.html`. I watched it run in the browser, but I didn't test everything. **What I saw working:** - **Start:** pressing Enter starts a game. - **Aliens:** the three alien types animate and march sideways in formation. - **Bombs:** aliens fire bombs back at the player. - **Bunkers:** the bombs chip away at the bunkers. - **Display:** the score, high score, level and lives show on screen, and there were no console errors. **Not tested:** - **Player shooting:** I sent one Space keypress, but the score stayed at 0 and I didn't confirm a hit on an alien. - **Movement:** I never tried moving the cannon left and right. - **Lives:** no bomb reached the cannon, so losing a life isn't confirmed. - **Other behavior:** I also didn't check game over, restart, pause, the bonus ship, or clearing a wave. **Controls:** - **Move:** ←/→ or A/D - **Shoot:** Space (one shot on screen at a time) - **Start or restart:** Enter - **Pause:** P **Rules:** - **Score:** the top row is worth 30 points, the next two rows 20, and the bottom two 10. A red bonus ship that crosses the top occasionally is worth 50 to 300. - **Lives:** you start with three. - **Difficulty:** the aliens speed up as their numbers drop. Each new wave starts lower and fires more bombs. - **Game over:** you lose if the aliens get too low or you run out of lives.