# Ruby scambler

#### Owen

##### Member
I just started ruby, so I made a scamble generator. It just comes up with random moves, so it's not very good (I got U U' U'). Made in 15 minutes.

20.times do

number = rand 9
if number == 1
puts "U"
elsif number == 2
puts "D"
elsif number == 3
puts "R"
elsif number == 4
puts "L"
elsif number == 5
puts "U'"
elsif number == 6
puts "R'"
elsif number == 7
puts "L'"
elsif number == 8
puts "B'"
end

end

Note: If you use the facepalm emoticon, on this thread, I will freak out.

Last edited:

#### Pedro

##### Member
why don't you have F moves?

to avoid U U' U, you have to first choose and axis, then choose a move

you have to allow R L, but not R L R

#### Owen

##### Member
why don't you have F moves?

to avoid U U' U, you have to first choose and axis, then choose a move

you have to allow R L, but not R L R
I new I was missing something.....

#### joey

##### Member
Missing F... is not the most important thing you're missing.

You're not really understanding how to really use ruby.

#### Lucas Garron

##### Member
Code:
StringJoin/@Tuples[{{"U", "R", "D", "L"}, {"", "'"}}[[Table[Random[Integer, {1, 8}], {20}]]] // StringJoin
Whee!

Edit: Except that your code is even WORSE than that. Do you even know how rand works in Ruby (or any other decent language)?

Last edited:

#### Stefan

##### Member
Judging by this, I say Ruby is an utterly ugly and inelegant language.

#### Swordsman Kirby

##### Member
Huh? It's missing D', B, F, F', U2, R2, L2, B2, F2, D2.

#### Stefan

##### Member
Huh? It's missing D', B, F, F', U2, R2, L2, B2, F2, D2.
Shut up! All of those can be achieved with combinations of the moves it does have!

#### tim

##### Member
Code:
20.times do

number = rand 9
if number == 1
puts "U"
elsif number == 2
puts "D"
elsif number == 3
puts "R"
elsif number == 4
puts "L"
elsif number == 5
puts "U'"
elsif number == 6
puts "R'"
elsif number == 7
puts "L'"
elsif number == 8
puts "B'"
end

end
1.) What about the random newlines?
2.) Use arrays like so:
Code:
moves = %w(U D R L F B)
20.times do
number = rand 6
puts moves[number]
end
3.) Learn some Ruby by getting this to work:
Code:
moves = %w(U D R L F B)
20.times do
puts moves.rand
end

#### Owen

##### Member
Oh, don't complain about my Ruby knowlage. I didn't say it was good.

"I just started ruby, so I made a scamble generator. It just comes up with random moves, so it's not very good (I got U U' U'). Made in 15 minutes."

20.times do

number = rand 11
if number == 1
puts "U"
elsif number == 2
puts "D"
elsif number == 3
puts "R"
elsif number == 4
puts "L"
elsif number == 5
puts "U'"
elsif number == 6
puts "R'"
elsif number == 7
puts "L'"
elsif number == 8
puts "B'"
elsif number == 9
puts "F"
elsif number == 10
puts "F'"
end

end

Last edited:

Gratuitous :fp

#### qqwref

##### Member
Saying "it's not very good" is an incredible understatement. This is seriously the worst attempt at a scrambler I've ever seen. I'm sure you're a beginning programmer, but you should at least put some more work into something before posting it on a forum - test it out, play with it a bit, fix all the really obvious errors (like having no F moves, or D', or B, or double turns...). Your scrambler doesn't even *work* - it doesn't turn all faces, it doesn't do the right number of moves (for random turns you should do 25, not 20), and it doesn't have even the most rudimentary move canceling.

#### Owen

##### Member
How does this deserve to be in "Speedcubing Discussion"?
Your right! This is not a disscusion, but a bunch of people insulting my scrambler! (I acually put this in "Puzzle theory", but I guess it got moved).

#### Lucas Garron

##### Member
How does this deserve to be in "Speedcubing Discussion"?
Your right! This is not a disscusion, but a bunch of people insulting my scrambler! (I acually put this in "Puzzle theory", but I guess it got moved).
It really didn't belong in Puzzle Theory.

#### Owen

##### Member
How does this deserve to be in "Speedcubing Discussion"?
Your right! This is not a disscusion, but a bunch of people insulting my scrambler! (I acually put this in "Puzzle theory", but I guess it got moved).
It really didn't belong in Puzzle Theory.
I put it there because thats were all the other scramblers were.

#### keemy

##### Member
hey so after seeing this i decided to make a scrambler for the lols it probably took a little more than 15 mins though (because was typed on a calculator darn and i had to learn 1 thing) but yeah it doesn't do F moves either so it must be good right.

less Fs in the scramble less possible to get F perm amirite?

#### Lucas Garron

##### Member
How does this deserve to be in "Speedcubing Discussion"?
Your right! This is not a disscusion, but a bunch of people insulting my scrambler! (I acually put this in "Puzzle theory", but I guess it got moved).
It really didn't belong in Puzzle Theory.
I put it there because thats were all the other scramblers were.
False. Second results if you searcher for "Scrambler" in the big Google field at the top. And the first result contains legitimate theory.

EDIT: Actually, NONE of the other results on the first search results page are in puzzle theory. If you're going to post any more in this thread, could you please check your facts? It's embarrassing.

#### Swordsman Kirby

##### Member
Huh? It's missing D', B, F, F', U2, R2, L2, B2, F2, D2.
Shut up! All of those can be achieved with combinations of the moves it does have!
Ah, of course. Unfortunately it can't possibly generate all possible states in 20 moves.

haha jeez harsh