from operator import itemgetter #just for sorting at the end.

#List of algs to compare.
# later to be graphically imported
algList = [
	"R U R' U' R' F R2 U' R' U' R U R' F'",
	"(y2) L' U' L U L F' L2 U L U L' U' L F", 
	"F R U' R' U R U R2 F' R U R U' R'",
	"(y2) B L U' L' U L U L2 B' L U L U' L'",
	"L2 U' L2 D F2 R2 U R2 D' F2 U",
	"R2 U' R2 D B2 L2 U L2 D' B2 U",
	"R2' u' R2 U R2' (y) R2 u R2' U' R2 U",
	"R2 U R2' U' R2 U' D R2' U' R2 U R2' D'", 
	"U2 r' U2 r U2 (x) U2 r U2 r' U2 R (z')",
	"R U R' U' R2 D R' U' R' U' R U (z') U2 R' U (z)",
	"R2 U R2 U' R2 F2 U' F2 D R2 D'"]
timesList = []; superList = []

#time estimations for individual moves
counts = {	'U':.09, "U'":.10, 'U2':.15,  	'u':.11, "u'":.12, 'u2':.17,
		'R':.08, "R'":.08, 'R2':.14,  	'r':.10, "r'":.11, 'r2':.14,
		'F':.13, "F'":.14, 'F2':.19,	'f':.15, "f'":.17, 'f2':.20,
		'D':.11, "D'":.12, 'D2':.17,	'd':.13, "d'":.14, 'd2':.19,
		'B':.17, "B'":.15, 'B2':.22,	'b':.19, "b'":.17, 'b2':.24,
		'L':.13, "L'":.18, 'L2':.22,	'l':.14, "l'":.19, 'l2':.24,
		
		'x':.18, "x'":.18, 'x2':.24,
		'y':.18, "y'":.18, 'y2':.24,
		'z':.19, "z'":.19, 'z2':.24,

		'M':.15, "M'":.11, 'M2':.18,
		'E':.22, "E'":.25, 'E2':.28,
		'S':.22, "S'":.25, 'S2':.28}

#get rid of dumb stuff
def filter(alg):
  ialg = alg.replace('(', '')		#get rid of unwanted
  ialg = ialg.replace(')', '')		# or otherwise unneeded characters
  ialg = ialg.replace("2'", '2')	# incl. whitespace, paren., 2's
  ialg = ialg.replace('  ', ' ')
  parts = ialg.split(' ')		#Divide the alg up into individual moves
  return parts

#Estimates the time of the algorithm
def algTime(moveList):			
  t = 0					#Set time to 0

  #print moveList
  for x in range(0, len(moveList)):	#for each move,
    t+=counts[moveList[x]]		# add the corresponding time

  return t				# and then return the total value  

#for every alg in the list, get the time, and throw
# those times in a list (timesList)
for alg in range(0, len(algList)):
  moves = filter(algList[alg])
  timesList.append(algTime(moves))

for q in range(0, len(timesList)):	#REPLACE THIS WITH SOMETHING
  superList.append([timesList[q], algList[q]])

superList.sort(key=itemgetter(0)) 

for w in range(0, len(superList)):
  print "%.2f" %superList[w][0], superList[w][1]