# Cube Twist: A 3D Twisty Cube Puzzle From 2×2 to 10×10

> Turn layers of a twisty cube in 3D, in one offline HTML file: drag a sticker to turn its layer with a snap, drag empty space to look around, scramble with an animation and see when it is solved, at any size from 2×2 to 10×10. The cube is built in code.

- Type: Lab Skill (downloadable Agent Skill)
- Category: [Game creation](https://www.sandbase.ai/skills/games)
- Version: 0.1.1
- Runs online: yes
- Page: https://www.sandbase.ai/skills/games/cube-twist

## What you get

Bring face colours, the sizes on offer and the look, and optionally the feel and scramble length. The Skill returns a downloadable Skill (the reference puzzle project, a customize guide, headless verification) and one playable example cube.

## Install

Download the Skill package from https://www.sandbase.ai/skills/games/cube-twist (sign-in required), unzip it into your agent's skills folder, then ask your agent to use it:

```text
/cube-twist make a twisty cube puzzle with <your colours>, sizes <from–to> and <your look>
```

## How it works

1. **Copy the finished cube game** Cube Twist starts with node scripts/new-project.mjs --out my-cube and npm ci on Node 22.4 or newer. The rules are in src/cube/model.js, drag gestures in src/cube/gesture.js and rendering in src/cube/view.js. Your coding agent reads references/customize.md for colours, backdrop, sticker shape, sizes, feel, scramble, framing, text or a new button. Nothing calls a model or paid service.
2. **Change values in config** Most requests are a value in src/config.js, which also holds the English TEXT. A prompt might ask for pastel face colours, sizes 3 to 7 and a slate backdrop. Read references/lessons.md before touching gesture code. Any image, font, sound or model you add goes in CREDITS.json with its licence, and no third-party brands or logos may appear.
3. **Build and run the cube checks** npm run build:single writes dist-single/index.html, about 0.55 MiB against an 8 MiB limit. npm run shoot needs local Chrome and writes shots/report.json and shots/*.jpg for a drag turn, mid-turn, release, view drag, scramble, solve, a 5 by 5, reset and a phone. Repeat until every check passes, then confirm the status reads Solved after a full solve.

## FAQ

### What does Cube Twist let you do?

Cube Twist is a playable 3D twisty cube from 2 by 2 to 10 by 10 in one HTML file. Drag a sticker and its layer follows, easing to the nearest quarter turn on release. Drag empty space to tumble the whole cube. Scramble plays random turns, and the status returns to Solved when every side is one colour.

### Does Cube Twist include a solver?

No. Cube Twist's Solve action, available only through act('solve'), replays the recorded turns backwards. A cube you mixed by hand must be solved by you. Picture cubes, where centre orientation matters, are not supported.

### Does Cube Twist remember my cube?

Only for the session, per size. Cube Twist keeps each order's cube while the page is open, because a sandboxed frame has no storage. Reset asks for a second tap before putting the cube back.

### Why did my Cube Twist drag turn the whole cube?

Cube Twist decides the layer once, after 5 px of movement. A drag that starts on a black gap between stickers rotates the whole cube instead of a hidden layer. Deciding once also stops a curving drag from jumping between layers.

### Does Cube Twist need a key or a network?

No. Cube Twist calls no model or paid service, and npm ci only downloads three.js, Vite and playwright-core from npm. The built file uses no network, storage, workers, dialogs or pointer lock.

### How does Cube Twist handle a 10 by 10?

Cube Twist draws order 10 as 1000 cubies and 600 stickers in two instanced draw calls. Positions are whole numbers and a quarter turn is a coordinate swap, so hundreds of turns never drift. Much larger orders would grow with the cube of the size.

## Examples

- Cube Twist 3D puzzle (scene)
- Classic 3×3 (video)
