oneshotlm
Compare all models on this prompt →

Rubik's Cube · claude-opus-5

Using the pre-provided three.min.js (global THREE), render an interactive 3D Rubik's Cube with clickable face rotations, orbit-drag camera, and a scramble button.

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

Using the pre-provided three.min.js (global THREE), render an interactive 3D Rubik's Cube with clickable face rotations, orbit-drag camera, and a scramble button.

assistant

I'll build the Rubik's cube app. Let me first check the library.

bash {"command":"ls -la /tmp/ws && grep -o 'REVISION=\"[^\"]*\"' three.min.js | head -1"}
toolResult

total 592 drwxr-sr-x. 2 node node 26 Aug 3 00:23 . drwxrwsrwx. 3 root node 16 Aug 3 00:23 .. -rw-r--r--. 1 node node 603445 Aug 3 00:23 three.min.js

assistant
bash {"command":"cd /tmp/ws && grep -o 'REVISION[=:]\"\\?[0-9a-z.\"]*' three.min.js | head -3; grep -c 'BoxGeometry' three.min.js; grep -o 'outpu
toolResult

REVISION=e 1

assistant
bash {"command":"cd /tmp/ws && grep -o 'REVISION=\"[0-9]*[a-z]*\"' three.min.js | head; grep -o 'REVISION=.\\{0,20\\}' three.min.js | head -3"}
toolResult

REVISION=e,t.RGBADepthPacking

assistant
thinking
I need to search for the version string using a different pattern—looking for something like "1[0-9][0-9]" that was assigned to a variable earlier in the code.
bash {"command":"cd /tmp/ws && grep -o 'e=\"1[0-9][0-9][a-z]*\"' three.min.js | head; grep -o '\"1[0-9][0-9]\"' three.min.js | head"}
toolResult

e="128" "128" "100"

assistant
thinking
I'm working with an older Three.js API where I need to use `renderer.outputEncoding` with `THREE.sRGBEncoding`, and I've confirmed that Raycaster and BoxGeometry are available—though RoundedBox isn't, so I'll stick with standard boxes. The design uses 27 cubies arranged as groups, each with a 0.95-sized mesh box and six materials that show color on exterior faces or dark on interior ones, positioned across logical coordinates from -1 to 1. For rotation, I'll select a layer by axis and coordinate, then animate the cubies using a temporary pivot group, with click-to-rotate interaction.

For the interaction model, I'm detecting clicks on cubie faces via raycasting, then using the drag direction to determine the rotation axis—the cross product of the face normal and drag direction. I'll differentiate between face turns (click+drag on a cubie) and camera orbiting (drag on background), with shift or right-button as modifiers for orbit anywhere. The implementation tracks cubies as an array with mesh and logical position, creates a pivot group as a child of the cube group to avoid transform math, animates the pivot rotation, then snaps the affected cubies' positions and quaternions back to the main structure when complete.

For the face normal, I'll compute it in cubeGroup local space by transforming the intersect face normal through the cubie's quaternion. On pointer move, I'll calculate the screen-space drag delta and test it against the two candidate axes perpendicular to the normal—projecting each candidate's tangent direction into screen space and choosing the one with the best alignment to the actual drag. I need to set a drag threshold to distinguish intentional rotations from noise.

I'm also adding keyboard controls for standard cube notation (U, D, L, R, F, B with shift for prime moves), plus a scramble button that queues random moves, and reset/undo functionality to track move history. I'm writing a helper function to project world-space directions into screen coordinates for the drag detection, and setting up the standard color scheme where each face gets its canonical color.

For the cube geometry itself, I'm using a material array per cubie where each face shows the sticker color if it's on the surface, otherwise dark. I'll add a slight gap between cubies for definition and use Lambert lighting for a clean look.

Writing the implementation...
write /tmp/ws/index.html (18264 bytes)
toolResult

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

assistant

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

modelclaude-opus-5
vendorAnthropic · Claude
harnesspi-agent
generated2026-08-03

EVALUATION

4/5 working

3D Rubik's Cube responds to drag/wheel with orbit/zoom and WASD turns a face (moves:1, scrambled), but click/arrows do nothing.

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.0%
on click0.0%
on drag10.4%
on wheel5.8%
on enter + space0.0%
on arrow keys0.0%
on w/a/s/d0.9%
frame spread51.9 / 255
console errors0
js errors none

METRICS

runtime115.3s
tokens in14k
tokens out10k
cached13k
cost / run$0.2689