From ca4da6650fdef8222670cb2feaf489f36701f1e1 Mon Sep 17 00:00:00 2001 From: Dan Ingenthron Date: Mon, 14 Oct 2019 15:29:58 -0500 Subject: [PATCH] Ruby anagrams --- README.md | 1 + Ruby/jumble_hello.rb | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Ruby/jumble_hello.rb diff --git a/README.md b/README.md index 6a06bbd..e78173e 100644 --- a/README.md +++ b/README.md @@ -33,3 +33,4 @@ Feel free to add your username here :) * [MauricioLanda](https://github.com/MauricioLanda) * [ShannonMCook](https://github.com/shannonmcook) * [Lashuk1729](https://github.com/Lashuk1729) +* [daningenthron](https://github.com/daningenthron) \ No newline at end of file diff --git a/Ruby/jumble_hello.rb b/Ruby/jumble_hello.rb new file mode 100644 index 0000000..dc36059 --- /dev/null +++ b/Ruby/jumble_hello.rb @@ -0,0 +1,25 @@ +# Ruby command-line Hello World app +# With thanks to the Internet Anagram Server, https://wordsmith.org/anagram/ +# Run 'ruby jumble_hello.rb' + +def jumble(word) + print word, "\r" + sleep 0.7 + 20.times do + word = word.chars.shuffle.join + print word, "\r" + sleep 0.03 + end +end + +def hello_world + jumble('World Hello') + jumble('Rolled Howl') + jumble('Howled Roll') + jumble('Howler Doll') + jumble('Droll Whole') + jumble('Lord Hell Ow') + puts 'Hello World'.ljust(12) # some strings are 12 characters instead of 11 +end + +hello_world