oneshotlm
Compare all models on this prompt →

Rubik's Cube · glm-4.5

Output generated Cost / run $0.0152 Runtime 64.9s

Prompt for this run

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 ↗

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

METRICS

runtime64.9s
tokens in14k
tokens out5.0k
cached8.6k
cost / run$0.0152
Transcript · 6 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
thinking
The user wants me to create a single-page web app with an interactive 3D Rubik's Cube. Let me plan this out:

1. Use the pre-provided three.min.js library
2. Create a 3D Rubik's Cube with:
   - Clickable face rotations
   - Orbit-drag camera
   - A scramble button

I'll need to:
1. Create the HTML structure with a canvas and button
2. Include the three.min.js script
3. Create CSS for styling
4. Create JavaScript for:
   - Three.js setup (scene, camera, renderer)
   - Cube geometry (27 smaller cubes for a 3x3x3)
   - Face colors (standard Rubik's cube colors)
   - Mouse interaction for orbit controls
   - Click detection for face rotations
   - Scramble functionality

Let me write this all in one index.html file.

I'll create an interactive 3D Rubik's Cube with all the features you requested. Let me build this single-page application.

→ write /tmp/ws/index.html (21584 bytes)
toolResult

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

assistant
thinking
I've created a complete, self-contained single-page web application with an interactive 3D Rubik's Cube. Let me verify the file was created properly.
→ bash {"command":"ls -la /tmp/ws/index.html"}
toolResult

-rw-r--r--. 1 node node 21592 Aug 1 20:43 /tmp/ws/index.html

assistant
thinking
Done! I've created a complete interactive 3D Rubik's Cube in a single `index.html` file. Here's what's included:

**Features:**
- 🎮 **Interactive 3D Rubik's Cube** - Full 3x3x3 cube with proper coloring (standard Rubik's scheme)
- 🖱️ **Orbit-drag camera** - Click and drag on empty space to rotate the view around the cube
- 🔄 **Clickable face rotations** - Click on any face and drag to rotate that slice
- 🔀 **Scramble button** - Randomly scrambles the cube with 20 moves
- 🔄 **Reset button** - Returns the cube to its solved state

**Technical details:**
- Uses the pre-provided `three.min.js` library (loaded via script tag)
- All CSS is inline in a `<style>` tag
- All JavaScript is inline in a `<script>` tag
- No external resources, CDNs, or network requests
- Touch support for mobile devices
- Responsive design that adapts to window size
- Smooth rotation animations
- Status indicator showing current action

**How to use:**
1. **Rotate camera**: Click and drag on the background (not on the cube)
2. **Rotate a face**: Click on any cube face and drag in the direction you want to rotate
3. **Scramble**: Click the "Scramble" button to mix up the cube
4. **Reset**: Click the "Reset" button to return to the solved state