cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
232 stars 42 forks source link

[Feature request] [Twizzle] x2 flips on clock #270

Closed kellantech closed 1 year ago

kellantech commented 1 year ago

Goal

I would like to be able to do x2 flips on the twizzle clock. Many cubers use x2 flips insed of y2 flips.

Possible solution

I have not read much of the code, but maybe mapping clocks and subtract from 12?

Alternatives

No response

lgarron commented 1 year ago

This sounds like a pretty reasonable request, but it does cause one wrinkle: it turns the orientation of the frame into a non-cyclic group (Dâ‚„ generated by <x, y>). This is also an issue with 4D puzzles, where we expand each orientation into a separate piece. The most general solution would be to allow an "orientation" to be a member of an arbitrary group, but that leads to more questions than it answers. We could use some ideas for other ways to do this.

We also can't ignore this the way we ignore clock pins, unfortunately, since the orientation of 12 o'clock affects the solved state.

I suspect the least ugly hack for clock would be to consider the front and back of the frame two separate pieces with 4 orientations each (essentially, an F "center" and a B "center"). I wouldn't mind doing that, but then we should also figure out how to add 12 o'clock and re-orient 18 clock orientations in the SVG to allow telling whether a state is solved. I think we can handle this using data-copy-id like here if we're willing to make 72 extra elements for the clocks.

kellantech commented 1 year ago

What about keeping the puzzle state like a y2 in memory, but flipping the clock for rendering? that would requre swapping of the moves (UR-DL, etc). That would solve the 12-o'clock problem.

lgarron commented 1 year ago

that would requre swapping of the moves (UR-DL, etc).

That's not compatible with our code, unfortunately. KPuzzle is based on the assumption that the permutation of a given move is independent of the state.

lgarron commented 1 year ago

@kellantech Try it out now: https://alpha.twizzle.net/edit/?puzzle=clock&title=Clock+notation+demo+%282023-06-26%29&alg=U1%2B+x2

lgarron commented 1 year ago

I suspect the least ugly hack for clock would be to consider the front and back of the frame two separate pieces with 4 orientations each (essentially, an F "center" and a B "center"). I wouldn't mind doing that, but then we should also figure out how to add 12 o'clock and re-orient 18 clock orientations in the SVG to allow telling whether a state is solved. I think we can handle this using data-copy-id like here if we're willing to make 72 extra elements for the clocks.

I ended up with something inbetween, which was to use invisible facelets to give each clock dial 4 cardinal hour locations that can show 12 o'clock.