Skip to content

Instantly share code, notes, and snippets.

@theirishpenguin
Created August 25, 2014 08:18
Show Gist options
  • Save theirishpenguin/7f7794ae35d04a042ced to your computer and use it in GitHub Desktop.
Save theirishpenguin/7f7794ae35d04a042ced to your computer and use it in GitHub Desktop.
A simple script to run a raffle, reading in from a CSV file of contestants
# quick-and-dirty Ruby script to raffle a prize
# author: Kevin Noonan.
# modified for suspense by theirishpenguin :)
#
# State in advance: attendance at the event is mandatory to be
# eligible for the prize-draw.
# If someone who's not attending is randomly chosen, re-run the script.
#
# (The list below has *all* Ruby Ireland members, at least on Meetup
# as at 15th April 2013.)
#
# Some people only use first-names on Meetup.
# Refer to the Meetup profile if you can't distinguish who should win.
ruby_irelanders = File.readlines('ruby_irelanders.csv')
size = ruby_irelanders.length
puts ""
puts "The suspense..."
puts ""
sleep 6
puts "Is"
puts ""
sleep 4
puts "So"
puts ""
sleep 6
puts "Stressful"
sleep 4
puts ""
puts "THE WINNER..."
puts ""
sleep 6
3.times do
random_choice=rand(size).to_i
puts "IT'S NOT #{ruby_irelanders[random_choice]}"
puts ""
sleep 2
puts "..."
puts ""
sleep 6
end
puts ""
sleep 6
random_choice=rand(size).to_i
puts "THE WINNER IS..."
puts ""
sleep 4
puts "#{ruby_irelanders[random_choice]}"
sleep 2
puts "YES!!!"
puts ""
sleep 2
puts "Claim your Rubymine IDE prize!!!"
puts ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment