Listing 9 ------------------- SUB Corners3 PrStr "Sort top corners", 3: n = 0: order = 0 DO UNTIL (order>900 AND order<1100).... ....OR order = 1111 n = n + 1 'number of loop IF n > 1 THEN RotCube 'rotate whole cube 'is u/r/f in correct position ? t1 = c(4,2,2): t2 = c(5,2,2) 'r & f colours i = c(1, 3, 1):j = c(5, 1, 3):k = c(4, 3, 3) IF i = t1 OR j = t1 OR k = t1 THEN IF i=t2 OR j=t2 OR k = t2 THEN order = 1000 END IF 'is u/r/b in correct position ? t1 = c(4,2,2): t2 = c(6,2,2) 'r & b colours i = c(1, 3, 3):j = c(4, 3, 1):k = c(6, 1, 3) IF i = t1 OR j = t1 OR k = t1 THEN IF i=t2 OR j=t2 OR k=t2THEN order=order+100 END IF 'is u/l/b in correct position ? t1 = c(3,2,2): t2 = c(6,2,2) 'l & b colours i = c(1, 1, 3):j = c(3, 3, 1):k = c(6, 3, 3) IF i = t1 OR j = t1 OR k = t1 THEN IF i=t2 OR j=t2 OR k=t2 THEN order=order+10 END IF 'is u/l/f in correct position ? t1 = c(5,2,2): t2 = c(3,2,2) 'l & f colours i = c(1, 1, 1):j = c(3, 1, 1):k = c(5, 1, 1) IF i = t1 OR j = t1 OR k = t1 THEN IF i=t2 OR j=t2 OR k=t2 THEN order=order+ 1 END IF IF order = 0 THEN 'no corners correct PrStr "Rotate top layer only ", 4 Rotpr 1,1:n = 0:PrStr blank,4:PrStr blank,6 END IF 'ie. need to go around loop again LOOP LOCATE 2, 58: PRINT "Order is "; order SELECT CASE order CASE 1000: 'only u/r/f correct so other 3 'must circulate - clock or anticlock? lc = c(3,2,2): bc = c(6,2,2) 'l & b colours IF c(1, 1, 1) = lc OR c(3, 1, 1) = lc .... .....OR c(5, 1, 1) = lc THEN IF c(1, 1, 1) = bc OR c(3, 1, 1) = bc .... .....OR c(5, 1, 1) = bc THEN PrStr "ie. L-1URU-1LUR-1U-1 ", 5 'u/l/f goes clockw. to u/l/b Rotpr 3,3: Rotpr 1,1:Rotpr 4,1: Rotpr 1,3 Rotpr 3,1: Rotpr 1,1:Rotpr 4,3: Rotpr 1,3 END IF END IF IF c(1, 3, 3) = lc OR c(4, 3, 1) = lc .... .....OR c(6, 1, 3) = lc THEN IF c(1, 3, 3) = bc OR c(4, 3, 1) = bc .... .....OR c(6, 1, 3) = bc THEN PrStr "ie. URU-1L-1UR-1U-1L ", 5 'u/r/b goes anticl. to u/l/b Rotpr 1,1: Rotpr 4,1: Rotpr 1,3:Rotpr 3,3 Rotpr 1,1: Rotpr 4,3: Rotpr 1,3:Rotpr 3,1 END IF END IF CASE 1001: 'u/r/f and u/l/f correct PrStr "ie. FU-1B-1UF-1U-1BU2 ", 5 Rotpr 5,1: Rotpr 1,3: Rotpr 6,3: Rotpr 1,1 Rotpr 5,3: Rotpr 1,3: Rotpr 6,1: Rotpr 1,2 CASE 1010: 'u/r/f and u/l/b correct PrStr "ie. UFURU-1R-1F-1 ", 5 Rotpr 1,1: Rotpr 5,1: Rotpr 1,1: Rotpr 4,1 Rotpr 1,3: Rotpr 4,3: Rotpr 5,3 END SELECT PrStr blank, 3: PrStr blank, 4 PrStr blank, 5: PrStr blank, 6 END SUB ------------------ End of listing