cubing.js icon indicating copy to clipboard operation
cubing.js copied to clipboard

Notation quirks

Open lgarron opened this issue 5 years ago • 1 comments

We need to support WCA notation.

Sample scrambles:

2x2x2 Cube: R' U' F U' F' U' R2 F2 U' F R2
3x3x3 Cube: D F D2 R' D' L U' R' F' B' R' U2 L' B2 R' B2 R2 D2 R
4x4x4 Cube: U' R' U' R2 U2 B R2 L F' U F2 D' R2 D F2 U2 B2 L2 Fw2 U2 Rw2 R F R2 F2 R' Uw2 Fw2 F R' Uw' F2 D2 F' L' Fw U' Rw2 F Uw' Rw2 B' L2
5x5x5 Cube: R Fw' Lw2 B2 U2 L R2 D' U' Rw2 Lw' F' Bw2 Dw' B2 Dw2 R' D2 Fw Lw' D' U' L Bw' U2 F2 R' F D Bw2 Dw B Dw' B' Lw Uw' R2 Lw L' U2 Lw2 R2 D2 U' Fw Dw2 Fw2 L2 Lw' F2 Rw' U2 R Dw F' L' Bw Rw' Dw' F'
6x6x6 Cube: U' R D2 F Bw2 Uw2 Bw2 U Dw Uw' Fw' F' Bw Uw2 D Rw 3Uw2 L2 Rw F Rw' F Fw' Dw2 B 3Fw' U D' 3Uw2 B' Lw2 Fw R F' 3Rw2 Bw 3Uw2 R' B' D' 3Uw' B' Bw Dw' D' U L 3Uw2 D2 B' Dw' Rw2 F Lw2 B 3Uw Lw R2 F2 Dw Rw' D2 F' Uw2 Bw' 3Fw' Lw' U Dw' B2 R D B2 3Rw' D' F Lw Fw2 3Uw Lw'
7x7x7 Cube: U2 Fw Lw Fw2 L' F' R' 3Bw Bw' 3Dw B2 3Fw2 Dw' D' Lw R' D L2 U2 Lw2 3Bw2 3Lw' L Rw' U' R' 3Uw' 3Rw' D2 B2 Fw2 3Lw 3Rw F' 3Uw' U' 3Bw' L B 3Bw2 3Lw' 3Fw2 3Dw 3Bw2 3Dw2 U F' U Fw2 3Dw 3Lw2 Dw' Uw U2 L2 F2 U F' 3Bw2 R' 3Rw U2 Lw' 3Dw2 Rw2 3Fw Rw Lw2 R Uw2 Rw' 3Dw' F Bw2 3Lw' 3Uw F' B2 Dw' Fw' 3Uw2 3Bw 3Lw2 Fw Rw2 3Fw' B 3Lw' 3Dw' 3Fw 3Rw2 Uw2 3Lw' L2 3Dw2 Lw U 3Uw F' 3Dw
     Clock: UR0+ DR2- DL5- UL5+ U2- R5- D1- L4- ALL3+ y2 U2- R1- D5+ L5- ALL3+ UL
  Megaminx: R-- D-- R++ D-- R-- D-- R++ D++ R++ D-- U' R-- D++ R-- D-- R++ D-- R++ D++ R++ D-- U' R++ D++ R-- D-- R++ D-- R++ D-- R++ D++ U R-- D-- R-- D++ R-- D-- R-- D-- R-- D-- U' R-- D++ R-- D++ R-- D-- R-- D++ R-- D++ U R++ D++ R-- D-- R-- D-- R++ D++ R++ D++ U R-- D++ R++ D-- R-- D-- R-- D-- R-- D-- U'
  Pyraminx: R B' R' L B' R' B L U R' U' u'
     Skewb: L R B U' R U' B L R B' U'
  Square-1: (0,-1) / (1,-2) / (-1,-4) / (0,-3) / (6,-3) / (4,0) / (3,0) / (3,0) / (-5,0) / (0,-2) / (0,-4) / (-2,0) /

Clock

  • y2 is a move, y is not.
  • Moves use + and - suffixes instead of leaving out the suffix or using ', respectively. Examples: R+, DR5-
  • Moves with an amount of 0 should not be removed, e.g. UR0+ should be kept during our transformations.
    • Syntactically, this is no problem. But e.g. our coalescing code assumes that we can remove moves that have 0 amount.
    • Alternative: allow removing moves, have a method to specifically turn a clock alg into a scramble using the commutativity of clock.
  • Moves without suffixes indicate moving pins, without permuting anything. That is, DR1+ means "move up the DR pin and turn its associated dial clockwise", while DR just means the "move up the DR pin".
    • This is not reversible, i.e. in general you can't assume that the opposite of DR is "move down the DR pin", as the pin may already be down. There is no notation for moving the pin down, and DR' is not valid notation.
    • Technically, WCA notation specifies that all clock pins godown at the end of a +/- move. In fact, the DR and the 5+ part of DR5+ are defined as if they are separate moves (DR moves a pin up, 5+ rotates the the corresponding dial and then moves all pins down.)
    • When reversing a clock alg, should the pin state be kept at the end of the alg? e.g. perhaps the inverse of R1+ U4- DR should be U4+ R1- DR

Megaminx

  • R++ / R-- / D++ / D-- are wide moves:
    • The suffix indicates an amount, e.g. R++ means moving 144°. If the parsed representation contains a value that counts the number of + signs, it's susceptible to exponential blowup. It's not too harmful if {R, 5} means R+++++, but I think we should guard against {R, 999999999} serializing to a gigabyte.
    • R++ does not turn around the same face as R, although D++ turns around the same face as D (D++ is effectively Dw).

I think an okay solution here would be to treat R++ as the base family itself, e.g. we could have R++2 and R++4' but not R++++. It would be similar to having both D and DB as moves (they both start with D, but they don't have common permutations). However, this contradicts the use of +/- for Clock to indicate move direction.

Square-1

  • "U"and "D" moves are grouped, in that order. I think decent options to represent (1, -2) / (-1, -4) could be:
    • specialSquare1Move{U: 1, D: -2} SLICE specialSquare1Move{U: -1, D: -4}
    • specialSquare1Group[U D2'] SLICE specialSquare1Group[U' D4']
    • (U D2') SLICE (U' D4')
    • U D2' SLICE U' D4'
    • (U D2') R2 (U' D4') (requires handling the "R2 is a move but R is not" situation)
    • U D2' R2 U' D4'
  • TNoodle (the WCA scramble program) doesn't put a comma after the U amount.

Pyraminx

  • U means "turn the top two layers, while u means "turn the top layer". This means we cannot use u to represent "wide" moves for Pyraminx, Master Pyraminx, etc.

lgarron avatar Jul 10 '20 06:07 lgarron

By the way, https://github.com/cubing/scramble-display/tree/main/src/parsers includes the parser definitions for <scramble-display>.

lgarron avatar Jul 10 '20 07:07 lgarron