An implementation of the Rubik's Cube algebra as described in Joyner's wonderful book.
If you take the Rubik's Cube apart (without peeling off any stickers)
and put it back together anyway that the pieces will fit,
you get a permutation of the stickers that may or may not be solveable anymore.
The collection of all such permutations is what Joyner calls the the
illegal Rubik's Cube group, and has been implemented as IRubik
.
Investigating this group provides insight into the actual Rubik's Cube group,
implemented here as Rubik
.
The Rubik's Cube group is the subgroup of the illegal group consisting of all elements satifying:
- sum of the corner permutations is zero (mod 3)
- sum of the edge permutations is zero (mod 2)
- corner permutation sign = edge permutation sign
See Theorem 11.2.1 of Joyner.
There is more documentation in the haddock.
The documentation can be built with stack:
stack build --haddock
The tests can be run with stack:
stack test --pedantic
While developing the models, it can be helpful to run ghcid in a separate shell:
make ghcid
or with tests included:
make ghcid-test