oneshotlm
Compare all models on this prompt →

Asteroids · glm-4.5

Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.

⛨ sandboxed Open in new tab ↗
transcript · 6 messages
user

Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.

assistant
thinking
The user wants me to build a playable Asteroids game in a single HTML file. Let me plan this out:

1. **Core Game Elements:**
   - Canvas-based rendering
   - Vector ship that can rotate and thrust
   - Shooting mechanics
   - Screen wrapping for ship and bullets
   - Asteroids that split into smaller pieces
   - Score tracking
   - Lives system
   - Game over state

2. **Controls:**
   - Arrow keys or WASD for rotation and thrust
   - Space to shoot

3. **Graphics:**
   - All procedural vector graphics (lines, no images)
   - Ship: triangle shape
   - Asteroids: irregular polygon shapes
   - Bullets: simple lines or dots

4. **Game Mechanics:**
   - Asteroids float and rotate
   - Ship wraps around screen edges
   - Bullets wrap around screen edges
   - Collision detection between:
     - Bullets and asteroids
     - Ship and asteroids
   - Asteroids split into 2 smaller ones when hit
   - Score increases when destroying asteroids
   - Lives decrease when ship is hit
   - Game over when lives = 0

Let me write this as a complete, self-contained HTML file with embedded CSS and JavaScript.

I'll create a complete Asteroids game with all the features you requested. Let me build this in a single HTML file.

write /tmp/ws/index.html (19201 bytes)
toolResult

Successfully wrote 19201 bytes to /tmp/ws/index.html

assistant
thinking
I've created a complete Asteroids game in a single HTML file. Let me verify it was created correctly and summarize what I built.
bash {"command":"ls -la /tmp/ws/index.html"}
toolResult

-rw-r--r--. 1 node node 19215 Aug 1 19:45 /tmp/ws/index.html

assistant
thinking
Done! I've created a complete, playable Asteroids game in `index.html` with:

**Features:**
- **Vector ship** - Triangle shape with thrust flame animation
- **Controls** - Arrow keys or WASD for rotation/thrust, SPACE to shoot
- **Screen wrapping** - Ship, bullets, and asteroids wrap around edges
- **Asteroids** - Procedurally generated irregular polygons that split into smaller pieces when shot
  - Large asteroids → 2 medium asteroids
  - Medium asteroids → 2 small asteroids
  - Small asteroids → destroyed
- **Scoring** - 20/40/60 points for small/medium/large asteroids
- **Lives** - 3 lives with ship invincibility after respawn
- **Particles** - Thrust exhaust and explosion effects
- **Progressive difficulty** - More asteroids spawn as score increases

**Visuals:**
- Classic vector graphics style (white lines on black)
- Blinking ship during invincibility
- Star field background
- Smooth animations

**Game states:**
- Start screen with instructions
- Playing state
- Game over with final score and restart option

The game runs entirely offline with no external dependencies. 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

modelglm-4.5
vendorZ.ai · GLM
harnesspi-agent
generated2026-08-01

EVALUATION

3/5 working

Asteroids game starts on space, asteroids move and respond to arrow/wasd keys, ship visible but lives lost during wasd test.

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 motion0.3%
on click0.3%
on drag0.3%
on wheel0.3%
on enter + space3.3%
on arrow keys2.5%
on w/a/s/d2.7%
frame spread17.2 / 255
console errors0
js errors none

METRICS

runtime74.2s
tokens in14k
tokens out4.8k
cached8.3k
cost / run$0.0146