programdemos/eigencube/eigencube.xtl

Eigencube: a Rubik's cube solved by linear algebra, a port of Steffen Smolka's eigencube.py (github.com/smolkaj/eigencube, MIT). Each of the 26 cubelets is the integer point c of {-1, 0, 1}^3 where it sits in the solved cube and carries a rotation matrix R: it sits now at R c. A quarter turn of the face with outward normal v moves the cubelets with v . (R c) > 0 by one matrix product. The model and the solver are the Eigencube library of X_eTaL-libraries (pinned in LIBRARIES_COMMIT, read from work/libraries by "just libraries"); this program scrambles a cube and solves it with it.

source · imports ec: /Users/mike/github/softwarewrighter/X_eTaL-demos/work/libraries/libs/Eigencube/src/Eigencube.xtl

A scramble

sc : Int

value · line 18
sc ← r̲oll! 20 r̲eshape 12

x : Int

value · line 20
x ← sc ᵉᶜd̲o ᵉᶜsolved

Solved

%10 : Int

value · line 27
(sol, lens, e) ← 1 ᵉᶜs̲olve x

sol : Int

value · line 27
(sol, lens, e) ← 1 ᵉᶜs̲olve x

lens : Int

value · line 27
(sol, lens, e) ← 1 ᵉᶜs̲olve x

e

value · line 27
(sol, lens, e) ← 1 ᵉᶜs̲olve x