cube.asm$BA70 · chip.bin

Cube Trainer

A Rubik's cube training web app that talks to a GAN smart cube over Web Bluetooth. Timer, algorithm drills, recognition quiz, solve replays and a 3D mirror of the cube in your hands.

run/play/cube/
↗ new tab

// Works with the virtual cube; a Bluetooth smart cube needs Chrome or Edge.

README.mdcube/index.mdx

A browser app for speedcubing practice that connects to a GAN i4 (or another GAN Gen2 smart cube) over Web Bluetooth. Turn the physical cube and the app sees every move.

What’s in it

Area What it does
Learn Training plans built from lessons, algorithm drills, recognition drills and timed solve goals, from two-look last layer up to full OLL and PLL
Mirror A 3D cube that follows your moves and, best-effort, the cube’s gyroscope
Timer WCA random-state scrambles, start and stop driven by the cube’s own clock, ao5 through ao100, named sessions
Trainer Free drills over OLL (57), PLL (21), COLL (40) and F2L (41)
Quiz Cube-free recognition: name a last-layer case from a 2D diagram
Review Per-case stats, trend sparklines and a weakness score, with a button to drill your worst cases
Reconstruction Replay any solve with a scrubber and per-move splits

No cube? A virtual one works with on-screen buttons or the keyboard.

How it works

React, Vite and TypeScript, with gan-web-bluetooth for the connection and cubing.js for 3D rendering, scrambles and cube state. A controller normalises events from either the real or the virtual cube and fans them out. Cube state is tracked as a cubing.js pattern and re-synced whenever the hardware reports its facelets, which keeps solved detection honest.

Two hooks hold the core loops (show a case, arm, time, detect solved; and scramble, arm, time, record), and every feature uses them, so all the drill stats land in one dataset.

The full algorithm sets were validated programmatically: each one parses, touches only what it should across all 24 orientations, and is distinct within its set. Charts are hand-rolled SVG.

Web Bluetooth means Chrome or Edge on desktop, or Chrome on Android, over HTTPS. GAN cubes also derive their encryption key from the Bluetooth MAC address, which browsers don’t expose, so the app tries to detect it and asks if it can’t.