DemoCode
Megaminx: 12 Sided Rubik’s Cube Simulator demo

This is a browser-based 3D simulator of the 12-sided Megaminx puzzle, built with React and Three.js. You can shuffle it, turn any face, and watch it solve itself.

It also includes a Learn mode and a how-to-solve guide, along with a move counter and timer.

How it works

The puzzle state is simple: twelve faces, each an array of eleven tile colors (a center and ten tiles around the rim). Turning a face rotates that array and cycles the three-tile strips on its five neighboring faces, using a hand-written adjacency table in App.js. Shuffle applies 30 random turns and records them. The Solve button replays that history in reverse with each turn inverted, speeding up as it goes. The puzzle counts as solved when every face is a single color.

For rendering, the puzzle is built from the 20 vertices of a dodecahedron, computed with the golden ratio. Each face is a pentagon that is cut into tiles and triangulated for Three.js. A turn is animated by attaching the face's pieces to a pivot and rotating it with an eased quaternion, and then the logical state is updated. Raycasting finds which face you touched.

The Learn mode steps through the main stages, such as building the star, inserting corners and pairing edges, drawing arc arrows on the face to turn. Demo buttons play each technique's move sequence on the puzzle.

Controls

  • Drag on empty space to orbit the puzzle.
  • Drag across a face to turn it clockwise or counterclockwise, depending on the drag direction.
  • Click or tap a face to select it, then use the left and right arrow buttons to turn it.
  • Shuffle scrambles, Solve reverses your moves, Learn starts the tutorial, and Reset restores the solved state.
  • How to solve opens the written guide.

Built with

React 19 and Three.js, bundled with Create React App. The source is on GitHub.