Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- Usage: python twistalltips.py < scrambles_file.txt > new_scrambles_file.txt
- """
- import random
- import sys
- tips = {"u", "l", "r", "b"}
- scrambles = sys.stdin.readlines()
- for scramble in scrambles:
- scramble_seq = scramble.split()
- twisted_tips = {move[0] for move in scramble_seq if move[0] in tips}
- additional_tips = tips - twisted_tips
- additional_scramble_seq = [tip + ["", "'"][random.randint(0, 1)] for tip in additional_tips]
- new_scramble = " ".join(scramble_seq + additional_scramble_seq)
- print(new_scramble)
Add Comment
Please, Sign In to add comment