oneshotlm
Compare all models on this prompt →

Bouncing balls in a heptagon · gemini-3.1-flash-lite

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 ↗
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
thinking
**Designing the App Structure**

I'm currently focused on the foundational structure. I've decided on a single-page app built with HTML, CSS, and JS, all within `index.html`. My main considerations are the rotating heptagon, the numbered balls dropping with simulated gravity and friction. The central elements are becoming well-defined.


**Refining Collision Mechanics**

I'm now diving deep into collision resolution. Specifically, I'm focusing on ball-ball and ball-wall interactions, aiming for realistic bouncing. I'm going for custom collision detection, with no external physics libraries. I'm leveraging a `canvas` and `requestAnimationFrame` for a smooth game loop. The `Ball` class, including x, y, velocities, and rotation are implemented. The heptagon geometry is built on rotation-based vertex calculations.


write index.html (4631 bytes)
toolResult

Successfully wrote 4631 bytes to index.html

assistant

The single-page web app is contained in `index.html`. It features: - **Heptagon geometry:** Calculated dynamically based on time to perform a full 360-degree rotation every 5 seconds. - **Physics Engine:** Custom implementations for gravity, air friction, and restitution (bouncing). - **Collision Detection:** - **Wall Collisions:** Point-to-segment distance calculations handle the boundary interactions of the rotating heptagon. - **Ball Collisions:** Impulse-based resolution ensures realistic bounces and transfer of momentum between the 20 numbered balls. - **Visuals:** Canvas rendering with rotating labels that reflect the angular velocity imparted during collisions. You can open `index.html` in any modern web browser to view the simulation.

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

modelgemini-3.1-flash-lite
vendorGoogle
harnesspi-agent
generated2026-07-22

EVALUATION

3/5 working

Heptagon spins with 20 numbered balls settled at bottom under gravity; no interactivity but matches core animation prompt.

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 motion4.3%
on click4.2%
on drag4.2%
on wheel4.2%
on enter + space4.2%
on arrow keys4.1%
on w/a/s/d4.2%
frame spread19.9 / 255
console errors0
js errors none

METRICS

runtime8.5s
tokens in5.1k
tokens out2.4k
cached0
cost / run$0.0049