Skip to content

Instantly share code, notes, and snippets.

@rhysforyou
Created August 26, 2010 09:16
Show Gist options
  • Save rhysforyou/551119 to your computer and use it in GitHub Desktop.
Save rhysforyou/551119 to your computer and use it in GitHub Desktop.
# Usage: "ruby heyjude.rb [verses] [output file]"
# Inspired by the flowchart at http://loveallthis.tumblr.com/post/166124704
def heyJude(n, fileName)
f = File.new(fileName, 'w')
n.times do |run|
f.syswrite "Hey Jude, "
if run % 3 == 1
f.syswrite "don't make it bad\n"
f.syswrite "take a sad song and make it better\n\n"
elsif run % 3 == 2
f.syswrite "don't be afraid\n"
f.syswrite "you were made to go out and get her\n\n"
else
f.syswrite "don't let me down\n"
f.syswrite "you have found her, now go and get her\n\n"
end
f.syswrite "remember to " +
if run % 2 == 1
"let her into your heart\n"
else
"let her under your skin\n"
end
f.syswrite "then you " +
if run % 2 == 1
"can start"
else
"begin"
end + " to make it better\n"
5.times { f.syswrite "better " }
f.syswrite "waaaa\n\n"
4.times do
7.times { f.syswrite "na " }
f.syswrite "\n"
4.times { f.syswrite "na " }
f.syswrite "\n\nHey Jude!\n\n"
end
end
end
heyJude(ARGV[0].to_i, ARGV[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment