Skip to content

Instantly share code, notes, and snippets.

@mildsunrise
Created April 30, 2023 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mildsunrise/9c06442f2c63f5aa2df8c789a5c94836 to your computer and use it in GitHub Desktop.
Save mildsunrise/9c06442f2c63f5aa2df8c789a5c94836 to your computer and use it in GitHub Desktop.
definition of the Cross Teaser group
'''
definition of the Cross Teaser group, using my groups library:
<https://github.com/mildsunrise/finite-algebra>
the puzzle is tilted 45 degrees, with the front slots in *down right* direction.
crosses are assigned in clockwise order, starting from the upper cross:
0
7 1
6 . 2
5 3
4
each of the CubeRot axis rotations cause the top face to move in these directions:
Z (clockwise turn)
o
. .
Y X
consult <https://tech.lgbt/@mildsunrise/110286601977677670> for more detailed info.
'''
from groups import WreathProduct, S8, CubeRot
X, Y, Z = CubeRot.X, CubeRot.Y, CubeRot.Z
Xp, Yp, Zp = CubeRot.Xp, CubeRot.Yp, CubeRot.Zp
X2, Y2, Z2 = CubeRot.X2, CubeRot.Y2, CubeRot.Z2
class CrossTeaser(WreathProduct):
BOTTOM = CubeRot
TOP = S8
# we can embed the klein four-group (symmetries of a non-square rectangle) in this group
ROT180 = CrossTeaser((Z2,) * 8, S8.FULL_CYCLE ** 4)
FLIPH = CrossTeaser((Zp * Y2,) * 8, S8.REVERSED * S8.FULL_CYCLE.inv)
FLIPV = FLIPH * ROT180
# clockwise cycle of the Upper and Right 3 crosses
U = CrossTeaser.from_cycles(( [7,0,1], [Y, X, Xp*Yp] ))
R = CrossTeaser.from_cycles(( [1,2,3], [X, Yp, Y*Xp] ))
# derive other 2 base moves
D, L = map(ROT180.conj, (U, R))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment