oneshotlm
Compare all models on this prompt →

Space Invaders · grok-4.3

Output generated Cost / run $0.0281 Runtime 76.7s

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

modelgrok-4.3
vendorxAI · Grok
harnesspi-agent
generated2026-07-22

METRICS

runtime76.7s
tokens in17k
tokens out7.0k
cached10k
cost / run$0.0281
Transcript · 8 messages
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
thinking
The task is: "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. P...
→ bash {"command":"ls -la /workspace"}
toolResult

total 4 drwxrwxrwx 2 node node 64 Jul 22 18:27 . drwxr-xr-x 1 root root 4096 Jul 22 18:27 ..

assistant
thinking
The task is to build a single-page web app: a playable Space Invaders game in one self-contained index.html file. Everything inline: CSS in <style>, JS in <script>. No external resources, CDNs, or net...The task is to build a playable Space Invaders game on a canvas in a single-page web app, all in one index.html file with inline CSS and JS. No external assets, everything procedural.

I need to create an HTML file that includes:

- <style> for CSS

- <script> for JavaScript 2D canvas game logic

Key features:

- Player cannon at bottom, moves left/right with keyboard, shoots with spacebar.

- Alien grid descending, moving side to side, shooting back.

- Destructible bunkers.

- Score and lives.

- Procedural graphics: draw with canvas primitives.

Since it's a single file 2D canvas game, I need to write the code for it.

But the user is asking me to build it, so I think the answer is the code for index.html.

The human message is: "Build a playable Space Invaders game on a canvas: ..." and then details.

I need to provide the code as the answer.

Confidence in \confidence{}.

I need to generate the full code.

This will be long, but let's try to write a complete simple version.
→ write /workspace/index.html (22822 bytes)
toolResult

Successfully wrote 22822 bytes to /workspace/index.html

assistant
thinking
The file is created. Let me verify it exists and is correct.
→ bash {"command":"ls -la /workspace/index.html && wc -c /workspace/index.html"}
toolResult

-rw-r--r-- 1 node node 22826 Jul 22 18:28 /workspace/index.html 22826 /workspace/index.html

assistant
thinking
The file has been created successfully as a self-contained single-file Space Invaders game with all required features:

Ready. The complete self-contained Space Invaders game is now in `/workspace/index.html`. **Features included:** - Full retro pixel-art procedural graphics (player, 3 alien types, animated UFO, bunkers, stars) - Smooth player movement + rapid shooting - Alien grid that descends, changes direction at edges, and randomly fires - 4 destructible bunkers with individual blocks - Live score / lives / level display - UFO bonus target - Keyboard controls (arrows/WASD + space), P to pause, R to restart - Basic touch support for tablets/phones - All logic fits in one 800×600 canvas file with embedded CSS/JS—runs fully offline Open `index.html` in any browser to play.