Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'Mors'
- from random import randint
- moves = ["F", "F'", "R", "R'", "L", "L'", "U", "U'", "D", "D'", "B", "B'", "F2", "R2", "L2", "U2", "D2", "B2"]
- scramble = []
- lenght = len(scramble)
- lenght_moves = len(moves) - 1
- def good_move(scramble, lenght):
- if scramble[lenght] == "R" or scramble[lenght] == "R'" or scramble[lenght] == "R2":
- if scramble[lenght - 1] == "R" or scramble[lenght - 1] == "R'" or scramble[lenght - 1] == "R2":
- return False
- if scramble[lenght] == "L" or scramble[lenght] == "L'" or scramble[lenght] == "L2":
- if scramble[lenght - 1] == "L" or scramble[lenght - 1] == "L'" or scramble[lenght - 1] == "L2":
- return False
- if scramble[lenght] == "F" or scramble[lenght] == "F'" or scramble[lenght] == "F2":
- if scramble[lenght - 1] == "F" or scramble[lenght - 1] == "F'" or scramble[lenght - 1] == "F2":
- return False
- if scramble[lenght] == "U" or scramble[lenght] == "U'" or scramble[lenght] == "U2":
- if scramble[lenght - 1] == "U" or scramble[lenght - 1] == "U'" or scramble[lenght - 1] == "U2":
- return False
- if scramble[lenght] == "D" or scramble[lenght] == "D'" or scramble[lenght] == "D2":
- if scramble[lenght - 1] == "D" or scramble[lenght - 1] == "D'" or scramble[lenght - 1] == "D2":
- return False
- if scramble[lenght] == "B" or scramble[lenght] == "B'" or scramble[lenght] == "B2":
- if scramble[lenght - 1] == "B" or scramble[lenght - 1] == "B'" or scramble[lenght - 1] == "B2":
- return False
- return True
- while (lenght < 20):
- print (lenght)
- print (scramble)
- random = randint(0, lenght_moves)
- if lenght - 1 >= 1:
- if good_move(scramble, lenght - 1) == False:
- print ("I'm here")
- while (good_move(scramble, lenght - 1)) != False:
- random = randint(0, lenght_moves)
- print (random)
- scramble.remove(lenght - 1)
- scramble.append(moves[random])
- else:
- scramble.append(moves[random])
- else:
- scramble.append(moves[random])
- lenght = len(scramble)
- print (scramble)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement