∇ Z←edge_parity State;Edges;S0;S1;E
[1] ⍝
[2] ⍝⍝ compute edge parity (to detect illegal cube states)
[3] ⍝
[4] Edges←2 4 6 8 10 12 16 18 20 22 24 26
[5] Z←0 ◊ E←0
[6] LOOP: →(12<E←E+1)/GOON ◊ S1←State[Edges[E];]
[7] S0←∆Initial_State[find_initial_pos S1;]
[8] →(S0≡S1)/LOOP ◊ →(S0≡S1[2 3 1])/LOOP ◊ →(S0≡S1[3 1 2])/LOOP
[9] Z←∼Z ◊ →LOOP
[10] GOON: →Z/0 ⍝ bad orientation
[11] IP←find_initial_pos¨⊂[2]State[Edges;]
[12] IPLP: →(0=⍴IP)/0
[13] →(1≠SMA←IP⍳⌊/IP)/1+↑⎕LC ◊ IP←1↓IP ◊ →IPLP ⍝ smallest is (already) first in IP
[14] Z←∼Z ◊ IP[SMA]←IP[1] ◊ IP←1↓IP ◊ →IPLP
∇
|