fork download
  1. alg = "R' D R"
  2.  
  3. wheres = cubies = "UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR".split()
  4. for move in alg.split():
  5. perm = "FLBR FRBL FDBU FUBD URDL ULDR".split()['UDLRFB'.index(move[0])]
  6. n = len(move) + move.endswith("'")
  7. table = ''.maketrans(perm, perm[n:] + perm[:n])
  8. wheres = [w.translate(table) if move[0] in w else w for w in wheres]
  9. for c, w in zip(cubies, wheres):
  10. if c != w:
  11. print(c, 'moved to', w)
Success #stdin #stdout 0.1s 10104KB
stdin
Standard input is empty
stdout
DF moved to FR
DB moved to DL
DL moved to DF
FR moved to DB
UFR moved to RFD
DRF moved to LBD
DFL moved to FRU
DLB moved to DFL