Advertisement
Guest User

RubyProblem

a guest
Feb 23rd, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.65 KB | None | 0 0
  1. def main
  2.   puts "enter your sigil phrase or word"
  3.   line = gets.chomp.squeeze!.to_a
  4.   p line
  5.   puts "with [1] or without [0] 'y'"
  6.   y_choice = gets.chomp.to_i
  7.  
  8.   to_remove = [ "a", "e", "i", "o", "u" ]
  9.   if y_choice == 0
  10.     to_remove.push("y")
  11.   end
  12.   p to_remove
  13.  
  14.   line = line - to_remove
  15.  
  16.   p line
  17.  
  18.   i = 1
  19.   while i < line.length - 1
  20.     temp = nil
  21.     slot_one = nil
  22.     slot_two = nil
  23.  
  24.     slot_one = rand(1..line.length - 1).to_i
  25.     slot_two = rand(1..line.length - 1).to_i
  26.     p slot_one, slot_two
  27.  
  28.     temp = line(slot_one)
  29.     line(slot_one) = line(slot_two)
  30.     line(slot_two) = temp
  31.  
  32.     i += 1
  33.   end
  34. end
  35.  
  36. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement