UP

Function get_moves


Definition

    ∇ Z←State get_moves B;Level;Pivot
[1]  ⍝
[2]  ⍝ return moves that are useful at Level. The levels are:
[3]  ⍝
[4]  ⍝ L1: solving the top face cross                 (= top face edge cubes)
[5]  ⍝ L2: solving the top face                       (+= top face corner cubes)
[6]  ⍝ L3: solving the middle face                    (= middle layer edge cubes)
[7]  ⍝ L4: solving the bottom face cross orientations (bottom layer edge cubes)
[8]  ⍝ L5: solving the bottom face cross positions    (bottom face edge cubes)
[9]  ⍝ L6: solving the bottom face                    (+= bottom face corner cubes)
[10] ⍝
[11] ⍝ The Pivot (1-4) is the cube being solved
[12] ⍝
[13] (Level Pivot)←B ◊ Z←0,'' ◊ →(L1,L2,L3,L4,L5,L6,0)[Level] ◊ +++
[14] L1: ⍝ all turns
[15] Z←,¨'LRFBUDlrfbud'
[16] Z←10,Z ◊ →0
[17] L2: ⍝ Apply dxDX, DXdx, or DXddx. They leave the top face intact except one
[18] ⍝ corner cube (into which the remaining cubes are rotated)
[19] ⍝    dxDX   DXdx   DXddx      - Pivot -
[20] Z←  'dlDL' 'DBdb' 'DBddb'   ⍝ 1:9:35  7
[21] Z←Z,'dbDB' 'DRdr' 'DRddr'   ⍝ 3:27:33 9
[22] Z←Z,'dfDF' 'DLdl' 'DLddl'   ⍝ 6:11:17 1
[23] Z←Z,'drDR' 'DFdf' 'DFddf'   ⍝ 8:19:25 3
[24] Z←10,Z ◊ →0
[25] L3: ⍝ Apply dyDYDXdx or DXdxdyDY. They leave the upper face and 3 middle
[26] ⍝ edges intact and swap the remaining middle edge with a bottom edge.
[27] ⍝ One side of the swapped edge remains on the same face (color)
[28] ⍝     dyDYDXdx   DXdxdyDY    X Y  dyDYDXdx  DXdxdyDY  ---- Pivot ----
[29] Z←   'dlDLDBdb' 'DBdbdlDL' ⍝ B L  B:D→L     L:D→B    #1 37:12 12:37 16
[30] Z←Z, 'dfDFDLdl' 'DLdldfDF' ⍝ L F  L:D→F     F:D→L    #2 13:20 20:13 10
[31] Z←Z, 'drDRDFdf' 'DFdfdrDR' ⍝ F R  F:D→R     R:D→F    #3 21:28 28:21 12
[32] Z←Z, 'dbDBDRdr' 'DRdrdbDB' ⍝ R B  R:D→B     B:D→R    #4 29:36 36:29 18
[33] Z←((⊂'dd'),,¨'Dd'),Z
[34] Z←10,Z ◊ →0
[35] L4: ⍝ Apply (3.1) XDYdyx. It rotates through bottom cross orientations,
[36] ⍝ leaving the bottom cross positions intact.
[37] ⍝     XDYdyx
[38] Z←'LDBdbl' 'RDFdfr' 'FDLdlf' 'BDRdrb'
[39] Z←10,Z ◊ →0
[40] L5: ⍝ Apply (3.0) fDBdFDDbDBDDb or (3.2) xdXdxddXdd. Both leave the bottom
[41] ⍝ cross orientations intact. fDBdFDDbDBDDb  swaps 2 bottom edges and
[42] ⍝ 2 bottom corners. xdXdxddXdd rotates 3 bottom cross edge cube positions.
[43] ⍝     xdXdxddXdd
[44] Z←  ⊂'fDBdFDDbDBDDb'   ⍝ swap edges 44:47 and corners 46:48
[45] Z←Z,⊂'ldLdlddLdd'      ⍝ X=L, 45 (R) fixed
[46] Z←Z,⊂'rdRdrddRdd'      ⍝ X=R, 44 (L) fixed
[47] Z←Z,⊂'fdFdfddFdd'      ⍝ X=F, 47 (B) fixed
[48] Z←Z,⊂'bdBdbddBdd'      ⍝ X=B, 42 (F) fixed
[49] Z←10,Z ◊ →0
[50] L6: ⍝ Apply (3.3) lDZdXDzd. It leaves the bottom cross and one bottom corner
[51] ⍝ intact and permutes the remaining 3 bottom corners
[52] ⍝     xDZdXDzd   DZdxDzdx      X Z  OR:YW:BG
[53] Z←   'lDRdLDrd' 'DRdlDrdL'   ⍝ L R, 32:38:48  27 fixed
[54] Z←Z, 'rDLdRDld' 'DLdrDldR'   ⍝ R L, 16:22:41  19 fixed
[55] Z←Z, 'fDBdFDbd' 'DBdfDbdF'   ⍝ F B, 14:46:40  21 fixed,
[56] Z←Z, 'bDFdBDfd' 'DFdbDfdB'   ⍝ B F, 30:24:43  25 fixed
[57] Z←(,¨'Bb'),Z
[58] Z←10,Z
    ∇

Call Graph (defined functions called from function get_moves)

Caller Graph (defined functions calling function get_moves)