oneshotlm
Compare all models on this prompt →

Bouncing balls in a heptagon · mistral-medium-3.1

Output generated Cost / run $0.0084 Runtime 31.4s

Prompt for this run

Show 20 numbered balls (1 to 20) dropping from the center of a heptagon that spins 360 degrees every 5 seconds. The balls are affected by gravity and friction, collide with each other, and bounce realistically off the rotating walls; show each ball's spin via the rotation of its number. Implement all collision detection yourself.

⛨ 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

modelmistral-medium-3.1
vendorMistral AI
harnesspi-agent
generated2026-08-01

METRICS

runtime31.4s
tokens in6.4k
tokens out3.7k
cached4.5k
cost / run$0.0084
Transcript · 4 messages
user

Show 20 numbered balls (1 to 20) dropping from the center of a heptagon that spins 360 degrees every 5 seconds. The balls are affected by gravity and friction, collide with each other, and bounce realistically off the rotating walls; show each ball's spin via the rotation of its number. Implement all collision detection yourself.

assistant
→ write index.html (12770 bytes)
toolResult

Successfully wrote 12770 bytes to index.html

assistant

Created a self-contained `index.html` with: 1. **Visuals**: - 7-sided heptagon (gray walls) spinning 360° every 5 seconds - 20 colored balls (numbered 1–20) with unique hues - Ball numbers rotate to show spin 2. **Physics**: - Gravity pulls balls downward - Friction slows movement and spin - Energy loss on bounces (80% elasticity) - **Custom collision detection**: - Ball-ball: Perfect elastic collisions with momentum transfer - Ball-wall: Reflects off rotating heptagon sides with proper normals - Spin affects/affected by collisions 3. **Implementation**: - Pure HTML5 Canvas (no external dependencies) - All math/geometry computed from first principles - Optimized animation loop (~60fps) Open `index.html` in any modern browser to run. The simulation is fully client-side with no network requests.