Created
July 18, 2018 17:59
-
-
Save meagar/5d45cffebefa563a8b3ca01e3abd9a4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIDES = %w(R L B F U D) | |
TURNS = ["", "2", "'"] # one turn, two turns, one counter-turn | |
moves = 20.times.inject([]) { |memo, _| memo + [(SIDES - [memo.last]).sample] } | |
p moves.zip(TURNS.cycle).map(&:join) # ["F", "L2", "U'", "B", "L2", "R'", "D", "U2", "B'", "D", "F2", "U'", "L", "B2", "U'", "D", "R2", "L'", "D", "F2"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment