fork(1) download
  1. from operator import itemgetter #just for sorting at the end.
  2.  
  3. #List of algs to compare.
  4. # later to be graphically imported
  5. algList = [
  6. "R U R' U' R' F R2 U' R' U' R U R' F'",
  7. "(y2) L' U' L U L F' L2 U L U L' U' L F",
  8. "F R U' R' U R U R2 F' R U R U' R'",
  9. "(y2) B L U' L' U L U L2 B' L U L U' L'",
  10. "L2 U' L2 D F2 R2 U R2 D' F2 U",
  11. "R2 U' R2 D B2 L2 U L2 D' B2 U",
  12. "R2' u' R2 U R2' (y) R2 u R2' U' R2 U",
  13. "R2 U R2' U' R2 U' D R2' U' R2 U R2' D'",
  14. "U2 r' U2 r U2 (x) U2 r U2 r' U2 R (z')",
  15. "R U R' U' R2 D R' U' R' U' R U (z') U2 R' U (z)",
  16. "R2 U R2 U' R2 F2 U' F2 D R2 D'"]
  17. timesList = []; superList = []
  18.  
  19. #time estimations for individual moves
  20. counts = { 'U':.09, "U'":.10, 'U2':.15, 'u':.11, "u'":.12, 'u2':.17,
  21. 'R':.08, "R'":.08, 'R2':.14, 'r':.10, "r'":.11, 'r2':.14,
  22. 'F':.13, "F'":.14, 'F2':.19, 'f':.15, "f'":.17, 'f2':.20,
  23. 'D':.11, "D'":.12, 'D2':.17, 'd':.13, "d'":.14, 'd2':.19,
  24. 'B':.17, "B'":.15, 'B2':.22, 'b':.19, "b'":.17, 'b2':.24,
  25. 'L':.13, "L'":.18, 'L2':.22, 'l':.14, "l'":.19, 'l2':.24,
  26.  
  27. 'x':.18, "x'":.18, 'x2':.24,
  28. 'y':.18, "y'":.18, 'y2':.24,
  29. 'z':.19, "z'":.19, 'z2':.24,
  30.  
  31. 'M':.15, "M'":.11, 'M2':.18,
  32. 'E':.22, "E'":.25, 'E2':.28,
  33. 'S':.22, "S'":.25, 'S2':.28}
  34.  
  35. #get rid of dumb stuff
  36. def filter(alg):
  37. ialg = alg.replace('(', '') #get rid of unwanted
  38. ialg = ialg.replace(')', '') # or otherwise unneeded characters
  39. ialg = ialg.replace("2'", '2') # incl. whitespace, paren., 2's
  40. ialg = ialg.replace(' ', ' ')
  41. parts = ialg.split(' ') #Divide the alg up into individual moves
  42. return parts
  43.  
  44. #Estimates the time of the algorithm
  45. def algTime(moveList):
  46. t = 0 #Set time to 0
  47.  
  48. #print moveList
  49. for x in range(0, len(moveList)): #for each move,
  50. t+=counts[moveList[x]] # add the corresponding time
  51.  
  52. return t # and then return the total value
  53.  
  54. #for every alg in the list, get the time, and throw
  55. # those times in a list (timesList)
  56. for alg in range(0, len(algList)):
  57. moves = filter(algList[alg])
  58. timesList.append(algTime(moves))
  59.  
  60. for q in range(0, len(timesList)): #REPLACE THIS WITH SOMETHING
  61. superList.append([timesList[q], algList[q]])
  62.  
  63. superList.sort(key=itemgetter(0))
  64.  
  65. for w in range(0, len(superList)):
  66. print "%.2f" %superList[w][0], superList[w][1]
Success #stdin #stdout 0.01s 6692KB
stdin
Standard input is empty
stdout
1.36 F R U' R' U R U R2 F' R U R U' R'
1.37 R U R' U' R' F R2 U' R' U' R U R' F'
1.46 R2 U R2 U' R2 F2 U' F2 D R2 D'
1.53 R2' u' R2 U R2' (y) R2 u R2' U' R2 U
1.55 R2 U R2' U' R2 U' D R2' U' R2 U R2' D'
1.61 L2 U' L2 D F2 R2 U R2 D' F2 U
1.67 R2 U' R2 D B2 L2 U L2 D' B2 U
1.77 U2 r' U2 r U2 (x) U2 r U2 r' U2 R (z')
1.83 R U R' U' R2 D R' U' R' U' R U (z') U2 R' U (z)
2.08 (y2) L' U' L U L F' L2 U L U L' U' L F
2.13 (y2) B L U' L' U L U L2 B' L U L U' L'