Bouncing balls in a heptagon · claude-opus-5
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.
transcript · 4 messages
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.
thinking
I'm building a physics simulation in HTML with a rotating heptagon container and balls that interact with gravity, friction, and collisions—both with the spinning walls and with each other, accounting for rotational dynamics and spin friction. Let me work through the physics setup, starting with the container geometry and angular velocity, then defining the ball properties including mass and moment of inertia. Writing physics engine... Now I'm working out the effective mass for the tangential impulse—with the perpendicular contact point, the cross product simplifies nicely to give me 3/m as the effective mass. I'll apply both normal and tangential impulses to update the ball's linear and angular velocity, using the cross product to convert forces into torque. For the simulation itself, I'm setting up balls dropping from the center with staggered timing, using a canvas of 600x600 with a wall radius of 260 and ball radius of 16, then rendering the numbers rotated by each ball's orientation. Writing the simulation code...
/tmp/ws/index.html (11421 bytes)Successfully wrote 11421 bytes to /tmp/ws/index.html
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
EVALUATION
Numbered balls bounce and settle inside a rotating heptagon under gravity; input doesn't visibly alter physics beyond natural motion.
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.