oneshotlm
Compare all models on this prompt →

Space Invaders · hy3-preview

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 ↗
transcript · 4 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 user wants me to build a Space Invaders game as a single-page web app in one self-contained index.html file. The requirements are:
1. Player cannon that moves and shoots
2. Descending grid of aliens that advance and fire back
3. Destructible bunkers
4. Score and lives
5. Procedural graphics only, no external assets
6. All in one index.html file with inline CSS and JS
7. No external resources, CDNs, or network requests

I need to create a complete Space Invaders game using HTML5 Canvas. Let me plan the structure:
- HTML structure with canvas element
- CSS for basic styling (centering, background)
- JavaScript with:
  - Game state management
  - Player cannon (movement with arrow keys, shooting with space)
  - Alien grid (movement patterns, shooting)
  - Bunkers (destructible with bullets)
  - Collision detection
  - Score and lives display
  - Game loop

I'll write this all in one file

I'll create a complete Space Invaders game in a single self-contained HTML file with procedural graphics, no external assets.

write /workspace/index.html (10010 bytes)
toolResult

Successfully wrote 10010 bytes to /workspace/index.html

assistant
thinking
The user asked me to build a playable Space Invaders game, and I've created a complete single-page web app in index.html with all the required features:

1. Player cannon that moves (arrow keys) and shoots (spacebar)
2. Descending grid of aliens that advance and fire back
3. Destructible bunkers
4. Score and lives display
5. Procedural graphics only - no external assets

The game includes:
- Canvas-based rendering with procedural alien shapes (3 different types)
- Player movement with arrow keys
- Shooting with spacebar (max 3 bullets on screen)
- Alien AI that moves side to side, drops down, and shoots back
- Destructible bunkers made of pixel grids
- Collision detection between bullets, aliens, bunkers, and player
- Score tracking and lives system
- Level progression when all aliens are destroyed
- Game over state with restart option (R key)
- Pause functionality (P key)

The file is completely self-contained with no external resources, CDNs, or network requests. All CSS is in a <style> tag, all JS is in a <script> tag, and the game runs fully sandboxed.

Let me verify the file was created properly by reading it back

The Space Invaders game has been created in `/workspace/index.html`. Here's what's included: **Features:** - **Player cannon** - Move with arrow keys, shoot with spacebar (max 3 bullets on screen) - **Alien grid** - 5 rows × 10 columns of 3 alien types with procedural pixel art - **Alien behavior** - Sweep side-to-side, drop down when hitting edges, shoot back randomly - **Destructible bunkers** - 4 bunkers made of destructible pixel grids - **Score & lives** - Score display, 3 lives, game over detection - **Level progression** - Aliens speed up as fewer remain, new level when all destroyed - **Controls** - P to pause, R to restart after game over **Procedural graphics:** - 3 distinct alien designs (squid, crab, octopus) drawn with rectangles - Player cannon with base, barrel, and treads - Bunkers as pixel grids with arch cutouts - All colors defined in code, no external assets Open `index.html` in a browser to play!

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

modelhy3-preview
vendorTencent · Hunyuan
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Classic Space Invaders with alien grid, player cannon, bunkers, score/lives; keys shoot/move and aliens get destroyed.

Vision grade · anthropic/claude-sonnet-5

MEASUREMENTS

Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.

idle motion7.5%
on click10.8%
on drag10.4%
on wheel10.4%
on enter + space8.3%
on arrow keys10.5%
on w/a/s/d9.9%
frame spread30.4 / 255
console errors0
js errors none

METRICS

runtime70.7s
tokens in3.9k
tokens out4.2k
cached2.8k
cost / run$0.0012