Created
July 18, 2018 17:54
-
-
Save meagar/d484eb4a1868b83513dac2c61bc5710d to your computer and use it in GitHub Desktop.
This file contains 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 | |
N = 20 | |
last = "" | |
moves = N.times.map do | |
side = (SIDES - [last]).sample | |
turn = TURNS.sample | |
last = side | |
[side, turn].join | |
end | |
puts moves.join(", ") # F', B, F2, D2, U', R', D2, B2, L2, R2, U, L, U, L, U2, R2, D2, U, F', B' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shouldn't
N
be equal to18
?SIDES * TURNS